100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary Concurrency and Parallelism in Operating Systems £15.49   Add to cart

Summary

Summary Concurrency and Parallelism in Operating Systems

 3 views  0 purchase

talks about various methods of using parallelism in operating systems to achieve efficiency

Preview 2 out of 8  pages

  • July 27, 2023
  • 8
  • 2022/2023
  • Summary
All documents for this subject (4)
avatar-seller
rahulravi1
Concurrency

- Doing things that make it seem like they’re going in parallel or even doing things in true
parallelism

Problem: Concurrency inside the OS

- Kernels have multiple processes and threads running parallely
- Kernels maintain different data structures (E.g., process tables) which can be accessed
at the same time. (-> Race Conditions)

Race Conditions

- Multiple threads/processes try to access shared data at the same time
- Result: data can be corrupted or changed
- Need to avoid at all costs

Critical Section

- Piece of code, share resources between threads/processes are changed
- Only one thread should be able to use this at a point in time (Problem)

Solution: Critical Section Problem

- Mutual exclusion (only one at a time)
- Progress: process should be able to enter the critical section at some point in time
- Fairness: wait times are distributed fairly, process cannot be made to wait forever

Mutual Exclusion

- Only one process at a time in the critical section
- Process need to get “permission” before entering the critical section
- Request a lock
- Hold a lock
- Release a lock

, Implementing Enforcing Mutual Exclusion: Software


Peterson’s Solution

2 Shared Variables Used
- Turn: indicates which process is next to enter the
critical section
- Boolean Flag[2]: indicates that the process is ready
to enter the critical section

Side Note 1: Works well on older machines
Side Note 2: Can generalize to multi-process

Conclusion: Satisfies all critical section requirements
(Mutual Exclusion, Progress, Fairness)


Implementing Enforcing Mutual Exclusion: Hardware

- User code can’t access the hardware directly (requires system calls)


Disabling Interrupts - Disable the interrupts
- Carry out the critical section
- Re-enable interrupts

test_and_set() - Using an external function
- Set a boolean variable to true/false

swap_and_compare() - Same stuff as test_and_set() but uses
integer values and compares old/new
values


Implementing Enforcing Mutual Exclusion: OS Based


Solution Mutexes Semaphores

About Contains a boolean variable lock (to Contains an integer variable
indicate availability)
Functions to Manipulate Semaphores
Function to Manipulate a Mutex - wait(): resource acquired and
- Acquire(): call before CS var decremented
- Release(): call after CS - post(): resource released and
var incremented
Needs to be serialized
Needs to be atomic
When m is acquired, it needs to be
released

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller rahulravi1. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £15.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

84866 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
£15.49
  • (0)
  Add to cart