Re: processes, tasks, threads
Re: processes, tasks, threads
- Subject: Re: processes, tasks, threads
- From: Ariel Feinerman <email@hidden>
- Date: Mon, 12 Apr 2010 00:04:52 +0300
Jens,
have you or anyone heard about "lightweigt process", is it the same as thread or not? Darwin multithreading technics are based on much threads, yes? I have found some links covers mach threads, but I think, they are slightly out of date.
Mac OS X Internals: A Systems Approach by Amit Singh
Can you suggest me books to read?
2010/4/10 Jens Alfke
<email@hidden>
A thread is just a flow of control -- a CPU state (registers) and a stack.
A process is what you think of as a program, what's listed in 'top' or Activity Monitor. It's a set of threads running in a memory address space plus a set of privileges (user and group ID, resource quotas, etc.)
"Task" is I think a synonym for process. I haven't heard "flow" before, but I'd guess it means the same as thread.
The above definitions hold for pretty much every OS, including Linux.
The notion of thread can get tricky because there can be multiple types of threads. The OS kernel manages threads and has system calls for them. There are portability APIs like pthreads that wrap these. But it's also possible for user code to implement it's own threading system, using calls like setjmp and ucontext that let you save and restore CPU state. These are often called "green" threads, a name that came from the original Java runtime. The advantage of these is that they can be extremely lightweight because they don't consume any kernel resources. But they're more difficult to work with because the kernel and system libraries don't understand them. (You usually see green threads in interpreted language runtimes like Java and Ruby.)
--Jens {via iPad}
On Apr 10, 2010, at 6:06 AM, Ariel Feinerman <
email@hidden> wrote:
> Hi,
> sorry for stupid question. What is the difference between process, task, flow and thread in the Darwin? What kind of relationsheeps between calls fork(), exec() and pthreads or mach threads? I heard that in some OS process and thread are the same entity at least in Linux.
> Thank you in advance,
>
> --
> best regards
> Ariel
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
best regards
Ariel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden