Definitions clarification — monolithic kernel/microkernel

"Please leave a message at the beep, we will get back to you when your support contract expires."

Moderators: phlip, Moderators General, Prelates

User avatar
Wildcard
Candlestick!
Posts: 253
Joined: Wed Jul 02, 2008 12:42 am UTC
Location: Outside of the box

Definitions clarification — monolithic kernel/microkernel

Postby Wildcard » Wed Jul 22, 2015 6:57 am UTC

Okay, I've been digging around the web for definitions to clarify things and I have it mostly straight, but I want to check on one point of this with the crowd here.

From "Linux Essentials", which I'm reading, I got the following:
Roderick W. Smith wrote:...a monolithic kernel...is a kernel that does everything a kernel is supposed to do in one big process. ... Microkernels...move as many tasks as they can into non-kernel processes and then manage the communications between processes.

I realized I had only the fuzziest idea of the EXACT distinction between process, thread and task, so I hunted around and finally manage to find some decent definitions. (Most explanations are entirely circular, complex, and/or unhelpful, or they just fatuously state "Oh, they're all the same thing, really.")

Just one trick here: is the quoted text above actually accurate in its usage of the words "task" and "process"? I'm not really getting how that would work. Or should "process" be replaced with "thread" for the line to be accurate? I think I'm still not completely clear on these words....
There's no such thing as a funny sig.

User avatar
WanderingLinguist
Posts: 237
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Definitions clarification — monolithic kernel/microkerne

Postby WanderingLinguist » Wed Jul 22, 2015 8:02 am UTC

I don't think you can assign a specific technical meaning to the word "task" in general, other than "something a computer does" or "some work to be done" because it varies a lot depending on the context in which its used.

In some cases, I've seen "task" used to mean "process". But, for example, in Android, a "task" means a logical flow of activities from the user's point of view, relating to specific work that the user wants to accomplish, and is not necessarily related to a process (in Android, the activities that make up a given task may all exist in separate processes, or within the same process, or may not have an associated process at all if they are in the background and the system is low on memory).

So when it comes to assigning a specific technical meaning to "task", I'd be cautious. It depends on where it's used.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Definitions clarification — monolithic kernel/microkerne

Postby EvanED » Wed Jul 22, 2015 1:43 pm UTC

I'm with WanderingLinguist; "task" doesn't have a single formal definition. The quote is accurate with respect to process. As used in your quote, "task" just means what is being done at a high level -- e.g. process scheduling is probably a task, I/O scheduling is a task, translating file system operations to disk operations is a task, etc.

And no, "process" definitely shouldn't be replaced by "thread" or that loses both clarity and exactness. (It's still true, because "two tasks execute in two different processes" implies that they also execute in different threads... but it no longer provides a good definition, because it's also pretty important to the microkernel idea that different tasks are in different processes.)

I think I'm still not completely clear on these words....


Linux muddies the water slightly, but you can get 99.9% of the way there in terms of task vs process with:
  • Processes contain threads
  • Two threads in the same process share memory space and some other resources from the process

User avatar
Wildcard
Candlestick!
Posts: 253
Joined: Wed Jul 02, 2008 12:42 am UTC
Location: Outside of the box

Re: Definitions clarification — monolithic kernel/microkerne

Postby Wildcard » Wed Jul 22, 2015 7:44 pm UTC

Okay, that is very helpful. I also realized what was throwing me off; I had somehow foolishly mixed up what I was looking at in my Mac OS X Activity Monitor. (Duh....) The list shows *processes* and somehow I was thinking it was showing *threads*. I now see that my kernel_task, which is using 1.13 GB of RAM (monolithic kernel, yes?) has 85 threads! So then, in a microkernel, there would be a whole bunch of different processes that could be managed or force-quit individually if I so desired...right?
There's no such thing as a funny sig.

User avatar
WanderingLinguist
Posts: 237
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Definitions clarification — monolithic kernel/microkerne

Postby WanderingLinguist » Thu Jul 23, 2015 11:45 am UTC

Although I understand that mach was designed to be usable as a microkernel, you are right that the version of mach used in OS X and iOS is not a microkernel.

As a side note, since you mention the memory usage of kernel_task: One has to be a bit careful when looking at how much memory a given process uses. In most modern operating systems, each process gets its own virtual address space, parts of which are mapped to real physical memory. The thing is, multiple separate processes can actually have parts of their virtual address space mapped to the *same* physical memory. This happens, for example, when they each using a read-only copy of the same thing (for example, the same shared library). The result is that you can have two processes, each using 1GB of memory, and still have a total memory usage of only 1.5GB for the whole system, because 0.5GB is actually shared between the processes. I'm not a kernel expert, but I can imagine quite a few cases where the kernel might need to share memory with other processes, so I'd be wary of reading too much into the size of kernel_task.


Return to “The Help Desk”

Who is online

Users browsing this forum: No registered users and 5 guests