concurrency
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > concurrency




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    concurrency  
gio


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-22-06 12:21 AM

Hi all.
I have a multithread application running on a multiprocessor ( 2 thread
can be running at the same time).
Suppose I have 2 thread:
t1  lists the content of a directory (using opendir and readdir_r) and
t2 delete a file.

Suppose also I have a directory /home that contains 2 file txt1 and
txt2.

Consider this scenario:
t1 read and print the content of /home
t2 delete txt1.

if t1 and t2 are running at the same time there are 3 possibility:
1.: t2 deletes txt1 first that t1 reads it with readdir_r
(IN THIS CASE THE OUTPUT OF T1 IS : TXT2)
2.: t2 deletes txt1 after t1 has read it with readdir_r
(IN THIS CASE THE OUTPUT OF T1 IS : TXT1 TXT2 ALSO IF TXT1 DOESN'T
EXIST)
3.: t2 deletes txt1 at the same time t1 reads it with readdir_r

WHAT APPENS IN THIS CASE? CAN THIS OPERATION BE OVERLAPPED?
THANKS ALL.






[ Post a follow-up to this message ]



    Re: concurrency  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-22-06 12:21 AM

"gio" <giorginooo.rossi@yahoo.it> writes:

> Hi all.
> I have a multithread application running on a multiprocessor ( 2 thread
> can be running at the same time).
> Suppose I have 2 thread:
> t1  lists the content of a directory (using opendir and readdir_r) and
> t2 delete a file.
>
> Suppose also I have a directory /home that contains 2 file txt1 and
> txt2.
>
> Consider this scenario:
> t1 read and print the content of /home
> t2 delete txt1.
>
> if t1 and t2 are running at the same time there are 3 possibility:
> 1.: t2 deletes txt1 first that t1 reads it with readdir_r
>     (IN THIS CASE THE OUTPUT OF T1 IS : TXT2)
> 2.: t2 deletes txt1 after t1 has read it with readdir_r
>     (IN THIS CASE THE OUTPUT OF T1 IS : TXT1 TXT2 ALSO IF TXT1 DOESN'T
> EXIST)
> 3.: t2 deletes txt1 at the same time t1 reads it with readdir_r
>
> WHAT APPENS IN THIS CASE? CAN THIS OPERATION BE OVERLAPPED?
> THANKS ALL.

And you think it will help posting your very same question to a
bazillion different newsgroups?


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

PUBLIC NOTICE AS REQUIRED BY LAW: Any use of this product, in any
manner whatsoever, will increase the amount of disorder in the
universe. Although no liability is implied herein, the consumer is
warned that this process will ultimately lead to the heat death of
the universe.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:42 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register