Doherty
Doherty

Reputation: 115

How "threads" get CPU and time slice?

Kindly, help me understand the following 'thread' concepts:

  1. If concurrently running threads are part of a running process, how is time slice divided between multiple threads of a same process?

  2. Also, since there is no new Process Control Clock created, how do they get their share of CPU allocation? Is it like, dispatcher lets TCB access CPU?

Upvotes: 1

Views: 1959

Answers (1)

tdao
tdao

Reputation: 17668

That's operating system scheduling job. The OS has a thread pool of active threads, it implements scheduling algorithm to make sure each thread is given amount of CPU time to run. For example Linux uses Completely Fair Scheduling

Upvotes: 1

Related Questions