CSC423 - Lec10 - Distributed and Parallel ComputerSystems
CSC423 - Lec10 - Distributed and Parallel ComputerSystems
CSC 423
Spring 2021-2022
Lecture 10
Instructor
Dr / Ayman Soliman
➢ Contents
1) Introduction to Threads
2) Context Switching
5) System Models
6) Allocation Models
27/4/2022 Dr/ Ayman Soliman 2
❑ Introduction to Threads
➢ We build virtual processors in software, on top of physical
processors:
➢ Each thread runs strictly sequentially and has its own program
counter and stack to keep track of where it is. Threads share the CPU
just as processes do:
➢ first one thread runs, then another does (timesharing).
or terminated.
o when the thread holding the resource frees it. it calls wakeup,
which is defined to wakeup either exactly one thread or all the
threads waiting on the specified condition variable.
27/4/2022 Dr/ Ayman Soliman 15
❑ Implementing a Threads Package
➢ There are two main ways to implement a threads package: in user
space and in the kernel.
➢ Implementing Threads in User Space
o The kernel knows nothing about them.
o The threads run on top of a runtime system, which is a collection
of procedures that manage threads.
o When a thread executes a system call, goes to sleep.
o User-level threads allow each process to have its own customized
scheduling algorithm.
➢ user-level threads packages have some major problems.
o First among these is the problem of how blocking system calls are
implemented.
27/4/2022 Dr/ Ayman Soliman 16
❑ Implementing a Threads Package
➢ when a thread wants to create a new thread or destroy an existing
thread, it makes a kernel call, which then does the creation or
destruction.
➢ To manage all the threads, the kernel has one table per process with
one entry per thread. Each entry holds the thread's registers, state,
priority, and other information.
➢ Let us call the total input rate 𝜆 requests per second, from all the
users combined. Let us call the rate at which the server can process
requests 𝜇. For stable operation, we must have 𝜇 > 𝜆.
➢ It can be proven that the mean time between issuing a request and
getting a complete response, T, is related to 𝜇 and 𝜆 by the formula
1
𝑇=
𝜇−𝜆
27/4/2022 Dr/ Ayman Soliman 23
❑ Processor Allocation
➢ In all cases, an algorithm is needed for deciding which process
should be run on which machine.
➢ For the processor pool model, a decision must be made for every
new process.
that is, every processor can communicate with every other processor.