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:
- VLC process has only a single thread.
- MS Word has 5 threads in its process.
- Chrome creates a thread for each tab I open in the browser.
- All these programs are written in Java and all threads in these programs are created using the Thread class.
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?