Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


Для правообладателей

Обратная связь

Email: Нажмите что бы посмотреть 

Яндекс.Метрика

Презентация на тему Processes. Processes & Threads. (Chapter 3)

Содержание

ProcessA program in executionAn instance of a program running on a computerThe entity that can be assigned to and executed on a processorA unit of activity characterized by the execution of a sequence of instructions a
ProcessesPart IProcesses & Threads**Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3 ProcessA program in executionAn instance of a program running on a computerThe Address SpacePCBProcess in Memory MultiprogrammingThe interleaved execution of two or more computer programs by a single Processes The Process ModelMultiprogramming of four programsConceptual model of 4 independent, sequential Multiprogramming Cooperating Processes (I)Sequential programs consist of a single processConcurrent applications consist of Cooperating Processes (II)Cooperating processes need to share information Since each process has Threads: MotivationProcess created and managed by the OS kernelProcess creation expensive, e.g., Threads The Thread Model (1)(a) Three processes each with one thread(b) One process with three threads The Thread Model (2)Items shared by all threads in a processItems private to each thread The Thread Model (3)Each thread has its own stack Thread Usage (1)A word processor with three threads Thread Usage (2)A multithreaded Web server Thread Implementation - Packages Threads are provided as a package, including operations Implementing Threads in User SpaceA user-level threads package User-Level ThreadsThread management done by user-level threads libraryExamplesPOSIX PthreadsMach C-threadsSolaris threadsJava threads User-Level ThreadsThread library entirely executed in user modeCheap to manage threadsCreate: setup Kernel-Level ThreadsKernel is aware of and schedules threadsA blocking system call, will Implementing Threads in the KernelA threads package managed by the kernel Kernel ThreadsSupported by the KernelExamples: newer versions ofWindows UNIXLinux Linux ThreadsLinux refers to them as tasks rather than threads.Thread creation is PthreadsA POSIX standard (IEEE 1003.1c) API for thread creation and synchronization.API specifies Hybrid Implementations  Multiplexing user-level threads onto kernel- level threads Solaris Threads (LWP) LWP AdvantagesCheap user-level thread managementA blocking system call will not suspend the
Слайды презентации

Слайд 2 Process
A program in execution
An instance of a program

ProcessA program in executionAn instance of a program running on a

running on a computer
The entity that can be assigned

to and executed on a processor
A unit of activity characterized by
the execution of a sequence of instructions
a current state
an associated set of system resources

Слайд 3 Address Space
PCB
Process in Memory

Address SpacePCBProcess in Memory

Слайд 4 Multiprogramming
The interleaved execution of two or more computer

MultiprogrammingThe interleaved execution of two or more computer programs by a

programs by a single processor

An important technique that
enables a

time-sharing system
allows the OS to overlap I/O and computation, creating an efficient system


Слайд 5 Processes The Process Model
Multiprogramming of four programs
Conceptual model of

Processes The Process ModelMultiprogramming of four programsConceptual model of 4 independent,

4 independent, sequential processes
Only one program active at any

instant

Слайд 6 Multiprogramming

Multiprogramming

Слайд 7 Cooperating Processes (I)
Sequential programs consist of a single

Cooperating Processes (I)Sequential programs consist of a single processConcurrent applications consist

process
Concurrent applications consist of multiple cooperating processes that execute

concurrently
Advantages
Can exploit multiple CPUs (hardware concurrency) for speeding up application
Application can benefit from software concurrency, e.g., web servers, window systems

Слайд 8 Cooperating Processes (II)
Cooperating processes need to share information

Cooperating Processes (II)Cooperating processes need to share information Since each process


Since each process has its own address space, OS

mechanisms are needed to let process exchange information
Two paradigms for cooperating processes
Shared Memory
OS enables two independent processes to have a shared memory segment in their address spaces
Message-passing
OS provides mechanisms for processes to send and receive messages

Слайд 9 Threads: Motivation
Process created and managed by the OS

Threads: MotivationProcess created and managed by the OS kernelProcess creation expensive,

kernel
Process creation expensive, e.g., fork system call
Context switching expensive
IPC

requires kernel intervention expensive
Cooperating processes – no need for memory protection, i.e., separate address spaces

Слайд 10 Threads The Thread Model (1)
(a) Three processes each with

Threads The Thread Model (1)(a) Three processes each with one thread(b) One process with three threads

one thread
(b) One process with three threads


Слайд 11 The Thread Model (2)
Items shared by all threads

The Thread Model (2)Items shared by all threads in a processItems private to each thread

in a process
Items private to each thread


Слайд 12 The Thread Model (3)
Each thread has its own

The Thread Model (3)Each thread has its own stack

stack


Слайд 13 Thread Usage (1)
A word processor with three threads

Thread Usage (1)A word processor with three threads

Слайд 14 Thread Usage (2)
A multithreaded Web server

Thread Usage (2)A multithreaded Web server

Слайд 16 Thread Implementation - Packages
Threads are provided as

Thread Implementation - Packages Threads are provided as a package, including

a package, including operations to create, destroy, and synchronize

them

A package can be implemented as:
User-level threads
Kernel threads


Слайд 17 Implementing Threads in User Space
A user-level threads package

Implementing Threads in User SpaceA user-level threads package

Слайд 18 User-Level Threads
Thread management done by user-level threads library

Examples
POSIX

User-Level ThreadsThread management done by user-level threads libraryExamplesPOSIX PthreadsMach C-threadsSolaris threadsJava threads

Pthreads
Mach C-threads
Solaris threads
Java threads


Слайд 19 User-Level Threads
Thread library entirely executed in user mode
Cheap

User-Level ThreadsThread library entirely executed in user modeCheap to manage threadsCreate:

to manage threads
Create: setup a stack
Destroy: free up memory
Context

switch requires few instructions
Just save CPU registers
Done based on program logic
A blocking system call blocks all peer threads

Слайд 20 Kernel-Level Threads
Kernel is aware of and schedules threads
A

Kernel-Level ThreadsKernel is aware of and schedules threadsA blocking system call,

blocking system call, will not block all peer threads

Expensive

to manage threads
Expensive context switch
Kernel Intervention

Слайд 21 Implementing Threads in the Kernel
A threads package managed

Implementing Threads in the KernelA threads package managed by the kernel

by the kernel


Слайд 22 Kernel Threads
Supported by the Kernel

Examples: newer versions of
Windows

Kernel ThreadsSupported by the KernelExamples: newer versions ofWindows UNIXLinux


UNIX
Linux


Слайд 23 Linux Threads
Linux refers to them as tasks rather

Linux ThreadsLinux refers to them as tasks rather than threads.Thread creation

than threads.
Thread creation is done through clone() system call.


Unlike fork(), clone() allows a child task to share the address space of the parent task (process)

Слайд 24 Pthreads
A POSIX standard (IEEE 1003.1c) API for thread

PthreadsA POSIX standard (IEEE 1003.1c) API for thread creation and synchronization.API

creation and synchronization.
API specifies behavior of the thread library,

implementation is up to development of the library.
POSIX Pthreads - may be provided as either a user or kernel library, as an extension to the POSIX standard.
Common in UNIX operating systems.

Слайд 25 Hybrid Implementations
Multiplexing user-level threads onto kernel-

Hybrid Implementations Multiplexing user-level threads onto kernel- level threads

level threads


Слайд 26 Solaris Threads (LWP)

Solaris Threads (LWP)

  • Имя файла: processes-processes-amp-threads-chapter-3.pptx
  • Количество просмотров: 92
  • Количество скачиваний: 0