Docsity

Operating Systems: Critical Section Problem and Synchronization, Exams of Social structure and social organization

Toggle sidebar
bg1
Hardware Solutions For The
Critical Section Problem-
Operating Systems-Lecture Notes,
Study notes of Operating Systems
Bounded Waiting - correct answerA bound must exist on the number of times that other
processes are allowed to enter their critical sections after a process has made a request
to enter its critical section and before that request is granted
Assume that each process executes at a nonzero speed
No assumption concerning relative speed of the N processes
Bounded-Buffer Problem - correct answerN buffers, each can hold one item
Semaphore mutex initialized to the value 1
Semaphore full initialized to the value 0
Semaphore empty initialized to the value N.
Classical Problems of Synchronization - correct answerBounded Buffer Problem
Readers-Writers Problem
Dining Philosophers Problem
Deadlocks - correct answertwo or more processes are waiting indefinitely for an event
that can be caused by only one of the waiting processes
Dining-Philosophers Problem - correct answerShared data
Bowl of rice (data set)
Semaphore chopstick [5] initialized to 1
Mutual Exclusion - correct answerIf process Pi is executing in its critical section, then no
other processes can be executing in their critical sections
Peterson's Solution - correct answer-Two process solution
-Assume that the LOAD and STORE instructions are atomic; that is, cannot be
interrupted.
-The two processes share two variables:
*int turn;
*Boolean flag[2]
-The variable turn indicates whose turn it is to enter the critical section.
-The flag array is used to indicate if a process is ready to enter the critical section. flag[i]
= true implies that process Pi is ready!
pf3
pf4

Partial preview of the text

Download Operating Systems: Critical Section Problem and Synchronization and more Exams Social structure and social organization in PDF only on Docsity!

Hardware Solutions For The

Critical Section Problem-

Operating Systems-Lecture Notes,

Study notes of Operating Systems

Bounded Waiting - correct answerA bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted Assume that each process executes at a nonzero speed No assumption concerning relative speed of the N processes Bounded-Buffer Problem - correct answerN buffers, each can hold one item Semaphore mutex initialized to the value 1 Semaphore full initialized to the value 0 Semaphore empty initialized to the value N. Classical Problems of Synchronization - correct answerBounded Buffer Problem Readers-Writers Problem Dining Philosophers Problem Deadlocks - correct answertwo or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes Dining-Philosophers Problem - correct answerShared data Bowl of rice (data set) Semaphore chopstick [5] initialized to 1 Mutual Exclusion - correct answerIf process Pi is executing in its critical section, then no other processes can be executing in their critical sections Peterson's Solution - correct answer-Two process solution -Assume that the LOAD and STORE instructions are atomic; that is, cannot be interrupted. -The two processes share two variables: *int turn; *Boolean flag[2] -The variable turn indicates whose turn it is to enter the critical section. -The flag array is used to indicate if a process is ready to enter the critical section. flag[i] = true implies that process Pi is ready!

Progress - correct answerIf no process is executing in its critical section and there exist some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely Readers-Writers Problem - correct answerA data set is shared among a number of concurrent processes Readers - only read the data set; they do not perform any updates Writers - can both read and write. Problem - allow multiple readers to read at the same time. Only one single writer can access the shared data at the same time Semaphore - correct answer-Synchronization tool that does not require busy waiting -Semaphore S - integer variable -Two standard operations modify S: wait() and signal() *Originally called P() and V() -Less complicated -Can only be accessed via two indivisible (atomic) operations wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; } Solution to Critical-Section Problem - correct answerMutual Exclusion Progress Bounded Waiting Starvation - correct answerindefinite blocking. A process may never be removed from the semaphore queue in which it is suspended Synchronization Hardware - correct answer-Many systems provide hardware support for critical section code -Uniprocessors - could disable interrupts *Currently running code would execute without preemption *Generally too inefficient on multiprocessor systems **Operating systems using this not broadly scalable -Modern machines provide special atomic hardware instructions *Atomic = non-interruptable *Either test memory word and set value *Or swap contents of two memory words

Problem - allow multiple readers to read at the same time. Only one single writer can access the shared data at the same time Semaphore - correct answer-Synchronization tool that does not require busy waiting -Semaphore S - integer variable -Two standard operations modify S: wait() and signal() *Originally called P() and V() -Less complicated -Can only be accessed via two indivisible (atomic) operations wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; } Solution to Critical-Section Problem - correct answerMutual Exclusion Progress Bounded Waiting Starvation - correct answerindefinite blocking. A process may never be removed from the semaphore queue in which it is suspended Synchronization Hardware - correct answer-Many systems provide hardware support for critical section code -Uniprocessors - could disable interrupts *Currently running code would execute without preemption *Generally too inefficient on multiprocessor systems **Operating systems using this not broadly scalable -Modern machines provide special atomic hardware instructions *Atomic = non-interruptable *Either test memory word and set value *Or swap contents of two memory words