0% found this document useful (0 votes)
6 views2 pages

Ex 05

The document discusses the evolution of multithreading in modern operating systems, highlighting its benefits such as responsiveness, resource sharing, and scalability. It contrasts single-threaded and multi-threaded processes, explains concurrency versus parallelism, and outlines the challenges of multicore programming. Additionally, it describes various multithreading models, including many-to-one, one-to-one, and many-to-many, detailing their advantages and limitations.

Uploaded by

quyendz767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Ex 05

The document discusses the evolution of multithreading in modern operating systems, highlighting its benefits such as responsiveness, resource sharing, and scalability. It contrasts single-threaded and multi-threaded processes, explains concurrency versus parallelism, and outlines the challenges of multicore programming. Additionally, it describes various multithreading models, including many-to-one, one-to-one, and many-to-many, detailing their advantages and limitations.

Uploaded by

quyendz767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

3.

14 Threads
- The traditionel process assums a single thread of execution.
- Morden openrating systems extend the process model to support multithreading.
- To support threads , the Process Control Block is expanded to include information for each thread.

4.1 Overview
- Threads are the smallest unit of CPU untilization , consist of a thread ID, a program counter, a
register set , a stack.Thread
- Thread within the same process share the process's code section, data section, and openratings
system resources.

Single-threaded process vs Multi-threaded process:


- A single-threaded process is a process that has only one thread.
- A multi-threaded process is a process that has multiple threads, enabling concurrent execution of
multiple tasks.

Movation for Multi-threaded process:


- Morden Computer are often multithreaded to hanlde multiple tasks simultaneously.
- multithreadeding is particularly useful for applications running on muticore systems
as it allows parallel execution of CPU-intensive tasks.

Benefits of multithreadeding:
- Responsiveness: multithreading allows applications to remain responsive.For example
, a user interface can stay interactive while background thread handles a time-consuming task.
- Resource Sharing : Threads share memory and resources of their parent process by default.
- Economy : Creating and managing theads is faster than creating and managing processes.
- Scalability : Multithreading can improve the performance of applications that are designed to
handle multiple tasks concurrently.

Application of Multithreading:
- Web servers: handling multiple client requests concurrently.
- Database servers: processing multiple queries concurrently.
- Real-time systems: handling multiple events concurrently.
- Multimedia applications: playing multiple audio and video streams concurrently.

Concurrency and Parallelism:


- On single core system, thread execute concurrently through time-sharing.
- On multi-core system, thread execute in parallel.

4.2 Multicore Programing


- Muticore systems have evoled to meet the increasing demand for computing performace.
- These systems feature multiple computing cores on a single chip.
- Multicore programming is essential for effciently utilizing these cores and improving concurrency.
Concurrency vs Parallelism:
- Concurrency: Supports multiple tasks making progress, even if not simulatneously.
- Parallelism : Excutes multiple tasks simulatneously.

Single-core vs Multicore:
- On a single-core system , theads are interleaved over time.
- On a multicore system , threads can run in parallel on separate cores.

Prgramming Challenges: Designing and programming for muticore systems present several challenges
- Indentifying Tasks:break applications into separate, concurrent tasks that can run independently on
different cores.
- Balance:Ensure tasks perform equal work equal value justify the use of addtional cores.
- Data Splitting: Divide data accessed by tasks to run on separate cores.
- Data Denpendency: Synchronize tasks when one depends on the data from another.
- Testing and Debugging : Concurrent programs are harder to test and debug due to multiple
execution paths.

4.3Multithreading Models: MultiThreading can implemented at to levels: user threads and kernel
threads

Many to One Model:


- Maps many user-leval theads to a single kernel-level thread
- Threads management is handled by thread library in user space, making it efficient.
- Limitations :
- the entire process blocks if a user makes a blocking system call.
- Cannot take advantage of multicore systems, as only one thread can access kernel at a time

One to One Model:


- Map each user threads to a separate kernel thread
- advantage : Provides true concurrency, allowing multiple threads to run in parallel on multicore
systems.
- Limitations :
- creating a user thread requires creating a corresponding kernel thread, whicch can be resource-
intensive
- System often limit the number of threads to avoid performance overhead.
Many to Many Model:
- Maps multiple user-level threads to a smaller or equal number of kernel threads.
- Advantage : Developers can create as many user threads as needed, Kernel threads can run in
parallel on multicore systems.

You might also like