Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.

Similar presentations


Presentation on theme: "Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads."— Presentation transcript:

1 Processes Chapter 3

2 Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads in distributed systems –Clients/servers Code migration –Motivation and models –Migration in heterogeneous systems

3 Processes Virtual processors –Created by OS to execute a program –Process table to keep track of virtual processors Process is a program in execution –Executed on one of the virtual processors Operating systems ensure that processes are independent and transparent –Do not affect each other’s correctness –Resource sharing is transparent Address space

4 Costs of Processes Processes are costly Creating a process requires creation of an entire new address space –Initializing memory segment, copying instructions to text segment, initializing stack Switching b/w processes is costly as well –Saving CPU context, modify registers of the memory management unit, TLBs, swapping processes (if number of processors are larger than what can fit in main memory)

5 Threads Similar to a process –Perceived as execution of (a part of) program –Information maintained for sharing CPU is minimal Context of threads is captured by CPU context –May be a little more information is needed for management (like locks) Very little overheads –Thread switching is easy Can provide performance gains

6 Threads in Non-Distributed Systems With processes a blocking system call blocks the entire process –Interactive programs like spreadsheets –Computations cannot proceed while waiting on user inputs or vice-versa –Having two threads can solve problems Parallel programs –Multiple threads, single address space Cooperating programs need to communicate –IPCs are costly

7 Drawbacks of IPCs Needs kernel intervention (due to separate address spaces) Multiple context switches Context switches are costly (changing MMU, flushing TLB)

8 Implementing Threads Implemented as package –Creation, destruction, synchronization Simpler approach – User level thread library –All thread management is done at user level –Kernel not even that there are multiple threads Thread creation, destruction and context switching are cheap –Creating stack –Saving registers Drawback – Blocking system call blocks entire process

9 Lightweight Process A hybrid approach Lightweight process runs in context of single process Reside in kernel System also offers user-level threads –All operations occur in user mode Thread package can be shared by multiple LWPs LWP is created by kernel and given its own stack

10 Light-Weight Process

11 LWPs Continued LWP has a scheduling routine and searches for a thread to execute –Thread pool Context switching to a thread if found On mutex, context switching happens if a runnable thread is found –LWP need not be informed LWP context switching happens on a blocking system call Several advantages –Cheap, will not block entire process, extends to multiprocessing environment


Download ppt "Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads."

Similar presentations


Ads by Google