LectureSet2 - COP 4610L Operating Systems Lab Distributed...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 4610L: Operating Systems Lab Distributed Applications in the Enterprise Lecture Set 2 Dr. R. Lent
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Concurrency and Multithreading
Background image of page 2
Concurrency l Concurrency : The execution of different activities (processes) in parallel l Concurrency cannot be avoided: ¡ Users are concurrent - a person can handle several tasks at once and expects the same from a computer. ¡ Multiprocessors are becoming more prevalent. ¡ A distributed system (client/server system) is naturally concurrent. ¡ A windowing system is naturally concurrent. ¡ When doing I/O (slow activity) it is helpful to handle concurrently additional work.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Terminology l Program: an executable file l Process: an instance of a program active in the system. An O.S. process is a unit of resource allocation both for CPU time and memory. l thread: a light-weight process (LWP). Name comes from expression “thread of control” l task: used either as process or thread l a program can have several processes or threads - some generated by the program itself, some by the operating system l a process can have several threads
Background image of page 4
Single and Multithreaded Processes Process descriptor
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Time Slicing l A thread/process runs for a short time ( quantum ) and then is pre-empted (O.S. re- evaluate which thread should be run) l This allows even single processor machines to run multiple threads l On PC's a timeslice tends to be about about fifty-five milliseconds long
Background image of page 6
Advantages of Multithreading l Some programs are required to do more than one thing at a time ¡ These programs are easier to design and implement with threads l Concurrency allows you to maintain a high availability of services ¡ each request for service can be handled by a new thread ¡ reduces bottleneck of pending requests
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Advantages of Multithreading (cont’d) l Concurrency can use CPU cycles more efficiently ¡ if one thread becomes blocked, other threads can be run l Concurrency supports asynchronous message passing ¡ objects can send messages and continue without having to wait for the message to be processed l Concurrency supports parallelism ¡ on machines with multiple CPUs, concurrent programming can be used to exploit available computing power to improve performance
Background image of page 8
Limitations of Multithreading l Safety ¡ Since threads within a program share the same address space, they can interfere with one another ¡ Synchronization mechanisms are needed to control access to shared resources l Liveness ¡ Threads can stop running for any number of reasons ¡ Deadlock can occur when threads depend upon each other to complete their activities l Nondeterminism ¡ Multithreaded activities can be arbitrarily interleaved l no two executions of the program need be identical l makes multithreaded programs harder to predict, understand and debug
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Limitations of Multithreading (cont’d) l Thread Construction Overhead ¡ Constructing a thread and setting it in motion is slower and more memory intensive than constructing a normal object and invoking a method on it
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/14/2011 for the course COP 4610L taught by Professor Staff during the Spring '09 term at University of Central Florida.

Page1 / 39

LectureSet2 - COP 4610L Operating Systems Lab Distributed...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online