




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
These are the Lecture Slides of Operating Systems and Architecture which includes Operating System Concerns, Basic Requirement, Difficulties, Need For Mutual Exclusion, Processes For Resources, Sharing etc.Key important points are: Threads, Resource Ownership, Allocated, Virtual Address, From Time to Time, Memory Plus Control, Child Process
Typology: Slides
1 / 44
This page cannot be seen from the preview
Don't miss anything!





































Chapter 4
Resource ownership z A process is allocated a virtual address space to hold the process image z A process , from time to time, may be assigned main memory plus control of other resources, such as I/O channels, I/O devices, and files.
z These two characteristics are treated independently by the operating system z Resource of ownership is referred to as a process or task
z A thread is a piece of program code executed in a serial fashion. z A thread is a dispatchable of work. It executes sequentially and is interruptable so that the processor can turn to another thread. z A process is a collection of one or more threads and associated system resources.
one processone thread
multiple processes one thread per process
multiple threads^ one process
multiple processes multiple threads per process
Single Threaded and
Multithreaded Process Models
Control^ Thread Block Stack^ User
Stack^ User
KernelStack
Kernel Stack
Address^ User Space
Address^ User Space Control^ Process Block
Control^ Process Block
Thread
Single-Threaded Process Model^ MultithreadedProcess Model
Control^ Thread Block Stack^ User Kernel Stack
Thread Control^ Thread Block Stack^ User Kernel Stack
Thread
Threads:Process Description Example Systems 1:M A thread may migrate from one process environment to another. This allows a thread to be easily moved among distinct systems.
Ra (Clouds), Emerald
M:M Combines attributes of M: and 1:M cases
TRIX
Examples of threading & Multithreading
z MS-DOS supports a single process and a single thread.
z Java support a single process with multiple threads
z UNIX supports multiple user processes but only supports one thread per process
z Solaris and Windows NT supports multiple user processes , each of which supports multiple threads
Interface) (1)
int thr_create( void* stackp, size_t stack_size, void* (funcp)(void), void* argp, long flags, thread_t* tid_p);
The address of a user-defined memory region. This memory is used as the new thread run- time stack. If the stackp value is NULL, the function allocates a stack region of stack_size bytes. 5 size_t stack_size The size of a user-defined memory region. This memory is used as the new thread run-time stack. If the stack_size value is 0, the function uses a system default value that is one Dr. Ming Zhang Docsity.com
The flags argument value may be zero, meaning that no special attributes are assigned to the new thread.
The flags value may using one or more of the following bit-flags:
THR_SUSPENDED: suspends the execution of the new thread until another thread calls the thr_continue function to enable it to execute
THR_NEW_LWP: Create a new LWP (LightWeight Process) along with the new Dr. Ming Zhang Docsity.com
The new thread ID is return via the tid_p argument.
If the actual value of the tid_p argument is assigned NULL, no thread ID is returned.
The thread ID data type is thread_t.
Dr. Ming Zhang Docsity.com
z Threads may be managed by either user- level library functions or the operating system kernel.
z Child processes as created by the fork system call are managed by the operating system kernel
z All threads in a process share the same data and code segment.
z A child process has its own copy of virtual address space that is separate from its parent process.