Re: is it possible to switch between threads manually.
On Oct 1, 12:21 pm, "hay...@alcatel-lucent.com"
I have program which utilizes 5 threads to complete the process.
when the application starts running, it randomly switches between
threads to complete the process as expected.
My question is, when the process is running, can i interrupt it
manually and switch between threads?
This depends very much on the system. I've never heard of a
system which has a request: switch to thread x, however.
for example, the application is running, now when i interrupted, the
applications thread is on thread3.
Now from thread3 can i switch to thread5 and continue with execution?
if yes, is there any difference in what operating system does and what
I'm not too sure what you're trying to do, but Posix threads
(and all real time systems, at least, have a provision for
thread priority; if an external event unblocks a thread with
higher priority than the one running, the thread with higher
priority is guaranteed to run. (Note that on a modern machine,
this doesn't mean that the orginally running thread is paused,
however. Most modern machines are capable of running several
threads at the same time.) This feature is optional, however,
and may not be implemented on the particular Posix
implementation which you're using.
if yes, is there a chance of getting coredump?
There's always a chance of getting a core dump. Even without
if yes, what happens to the stacks of other threads?
If you get a core dump, the process is terminated.
if yes, what happens to the thread which was interrupted manually( in
this case what happens to thread3)?
will thread3 starts from where it was stopped? or will it starts from
where it has been ordered by OS?
Appreciate your views and comments on this topic.
You'll have to explain what you're actually trying to do. In
comp.programming.threads, since that's where the threading
experts hang out. Note, however, that most threading issues are
very system dependent, and scheduling policies differ even
between different Posix implementations.
James Kanze (GABI Software) email:firstname.lastname@example.org
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34