For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2007 > Could I use a semaphore in this case?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Could I use a semaphore in this case?
K-mart Cashier

2007-06-24, 7:07 pm

I have two different users on a system. Both users have user (not
super users) privileges on this system. Also, both users are in the
same group. Now I want person A to add two numbers and send this
result to person B. I then want person B to check if the sum is even
or odd. If the sum is even, I then want person B to send back "It's an
even number." If it's an odd number, then person B would just discard
the results.

Is this possible to do with something like semaphores or named pipes?

Chad

Pascal Bourguignon

2007-06-24, 7:07 pm

K-mart Cashier <cdalten@gmail.com> writes:

> I have two different users on a system. Both users have user (not
> super users) privileges on this system. Also, both users are in the
> same group. Now I want person A to add two numbers and send this
> result to person B. I then want person B to check if the sum is even
> or odd. If the sum is even, I then want person B to send back "It's an
> even number." If it's an odd number, then person B would just discard
> the results.
>
> Is this possible to do with something like semaphores or named pipes?


Yes.

--
__Pascal Bourguignon__ http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
K-mart Cashier

2007-06-24, 7:07 pm

On Jun 23, 6:44 pm, Pascal Bourguignon <p...@informatimago.com> wrote:
> K-mart Cashier <cdal...@gmail.com> writes:
>
>
> Yes.
>
> --


Thanks.

niranjan.singh@gmail.com

2007-06-26, 8:05 am

On Jun 24, 7:12 am, K-mart Cashier <cdal...@gmail.com> wrote:
> On Jun 23, 6:44 pm, Pascal Bourguignon <p...@informatimago.com> wrote:
>
>
>
>
>
> Thanks.


use shared memory ,this can be used in form of shared secret .

Bin Chen

2007-06-26, 10:06 pm

On Jun 26, 7:59 pm, "niranjan.si...@gmail.com"
<niranjan.si...@gmail.com> wrote:
> On Jun 24, 7:12 am, K-mart Cashier <cdal...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> use shared memory ,this can be used in form of shared secret .


Why? Any secret benefits over domain socket or named pipe?

Maxim Yegorushkin

2007-06-28, 7:08 pm

On 26 Jun, 15:05, Bin Chen <binary.c...@gmail.com> wrote:
> On Jun 26, 7:59 pm, "niranjan.si...@gmail.com"
>
>
>
> <niranjan.si...@gmail.com> wrote:
>
>
>
[color=darkred]
>
> Why? Any secret benefits over domain socket or named pipe?


Probably one could declare a pointer to a volatile to that shared
memory and use busy waiting, rather than using synchronization
primitives. Just a wild guess, do not do that! ;)

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com