0

My textbook mentions the following sentence:

On operating systems that support them, it is kernel-level threads - not processes - that are being scheduled by the operating system.

I understand CPU scheduling, but this sentence does not make sense. Does it mean that the scheduler program allocates the CPU to kernel-level threads according to specific algorithms?

Aren't kernel-level processes also scheduled? Or do they not exist in operating systems which support kernel-level threads?

nightmarish
  • 183
  • 2
  • 11

2 Answers2

2

When referring to Threads and Processes in an operating system context, Process means a thread with its own memory space and Thread means a thread that shares it's memory space with other threads.

So Process context-switches have a higher cost than Thread context-switches, because there is a higher over-head for when switching process context.

Dominik P
  • 117
  • 10
2

The answer to this, as implied by the text that you quote, depends on the specific Operating System. However, a little definition of the terms may help to make things a little clearer.

Program A program is a sequence of instructions to perform a specific job. This is most often encountered as one or more executable files, including the main application and any libraries that it uses.

In embedded systems the program will be 'embedded' within the electronics when the device is manufactured*, e.g. ASICs, microcontrollers, FPGAs and otehr devices.

Process A process is an executing instance of a program. There may be more than one instance of a program running at the same time, such as when you open several documents using the same word processing program.

Each process will have its own memory and at least one Thread of execution. When you start a process the primary thread of that process is started when the program is loaded.

Thread A Thread (or task) is the sequence of instructions that the processor must execute to achieve a particular objective of the program.

In a multi-tasking Operating System, a process may have many tasks running. All of the tasks share the same memory as the parent process. So switching between tasks within a process is fairly easy, compared with switching between processes (which may involve exchanging the processes' memory via a swap file on a disk!)

Scheduling Depending on what needs to be done, the Operating System will schedule the threads that are needed or waiting need to do them. This may involve changing the current process, but usually (hopefully) it will not. Hence threads are scheduled and Processes are not.

*Some embedded devices include a 'Bootloader' that allows the program to be changed after it has been manufactured.

Evil Dog Pie
  • 2,300
  • 2
  • 23
  • 46