Unix Programming - while(1); in a thread

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2005 > while(1); in a thread





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 while(1); in a thread
James

2005-04-08, 5:52 pm

Hi,
I've made my own user level thread package using setjmp/longjmp
mechanism. However the problem in them is that if an infinite while
loop is present in any thread then the other thread/s never gets a
chance to run. I've seen the same problem in some other thread packages
also. So can somebody please tell me that is this problem a loophole in
my package(as well as other packages ) or it is a part of the user
level thread properties.


Thanks

Barry Margolin

2005-04-08, 8:48 pm

In article <1112990830.493356.96350@z14g2000cwz.googlegroups.com>,
"James" <james_unix@yahoo.com> wrote:

> Hi,
> I've made my own user level thread package using setjmp/longjmp
> mechanism. However the problem in them is that if an infinite while
> loop is present in any thread then the other thread/s never gets a
> chance to run. I've seen the same problem in some other thread packages
> also. So can somebody please tell me that is this problem a loophole in
> my package(as well as other packages ) or it is a part of the user
> level thread properties.


It's a problem with any non-preemptive multitasking design. If you
require a task to voluntarily give up the processor, you run the risk
that a task may not volunteer, and will monopolize the system.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com