Songo
Songo

Reputation: 5726

Process and threads scheduling in an operating system

I'm studying a course on Operating systems and I reached a part where it discusses processes and threads. I know a CPU can only run a single process at a time, so there are several scheduling algorithms out there to priorities the processes in the Ready queue.

Now when I moved to threads things started to get somewhat confusing. Since a process may consist of several threads will the scheduling be for each single thread or for each process?

For example:

I'm on Windows. I double click a song to start it in VLC then double click MS Word to start writing a report and finally open Chrome to check my mail.

Lets assume the following to simplify things:

Now which of these is a User thread and which is a Kernel thread?

Will scheduling be on the processes or on the threads?

Will the processes with higher number of threads run longer or is the operating system ignorant of the number of threads in each process?

Upvotes: 1

Views: 1087

Answers (1)

Jaffar Ramay
Jaffar Ramay

Reputation: 1165

Applications are developed via different languages and the different languages implement threading differently. There are basically 2 different implementations.

  1. Create separate Kernel Thread for each thread created in the application.
  2. Manage the application created thread within a main thread of application.

Note : Java's implementation could also vary JVM to JVM so it depends that which JVM and OS are used.

Coming to your next question. Scheduling will be on Threads not on Processes.

Upvotes: 1

Related Questions