5 Concurrency And Synchronization

Operating Systems · Unit 5

Concurrency and Synchronization

Exam-focused notes for Concurrency and Synchronization (Operating Systems, BIT204): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.

What this unit covers

  • Critical section problem
  • Race condition definition and examples
  • Lock variable solution
  • Semaphore operations
  • Producer consumer problem with semaphore
  • Producer consumer problem with message passing
  • Thread definition and characteristics
  • User level threads
  • Kernel level threads
  • Multithreading models

User level threads

208210 marks

Question

Differentiate between user thread and kernel thread. Given the following information about processes, compute the average waiting time and turnaround time for FCFS and Round Robin (Quantum = 2).

ProcessesCPU Burst TimeArrival Time
A92
B111
C10
D23
E74

[2+8]

Feature User Thread Kernel Thread --------- Management Managed by a user-level thread library Managed directly by the OS kernel Kernel awareness Kernel is unaware of them Kernel is aware and schedules them Context switch Fast, no kernel mode switch Slower, ...

Full solved answer →

Producer consumer problem with message passing

20805 marks

Write down the Solving technique of the producer consumer problem with Message passing? [5]

Message passing is an inter-process communication (IPC) technique where processes communicate by sending and receiving messages rather than using shared memory. This eliminates the need for explicit mutual exclusion (no shared variables, no semaphores). ---...

Full solved answer →

Lock variable solution

20795 marks

What is race condition? Explain critical problem solution using lock variable. [5]

A race condition occurs when two or more processes access shared data concurrently, and the final result depends on the order or timing of their execution. Because the processes "race" against each other, the outcome is unpredictable and may lead to data in...

Full solved answer →

Thread definition and characteristics

20795 marks

How threads differ from processes? Explain user level thread and kernel level thread. [5]

--- Aspect Process Thread --------- Definition An independent program in execution with its own address space A lightweight unit of execution within a process Memory Has its own separate memory space Shares memory (code, data, heap) with other threads of th...

Full solved answer →
20785 marks

What is thread? Explain user level thread and kernel level thread. [5]

A thread is the smallest unit of CPU execution within a process. It is also called a lightweight process (LWP). A thread shares the code section, data section, and OS resources (like open files and signals) with other threads belonging to the same process, ...

Full solved answer →

Producer consumer problem with semaphore

207810 marks

What is critical section? What are the operations that can be performed on the semaphore? Explain the solution to producer consumer problem using semaphore.[10]

--- A critical section is a segment of code in a process where the process accesses and manipulates shared resources (such as shared variables, files, or data structures) that must not be accessed by more than one process at the same time. Property Descript...

Full solved answer →

Critical section problem

010 marks

Define critical section problem. Explain race condition with suitable example.[10]

A critical section is a segment of code in which a process accesses shared resources (such as shared variables, files, or data structures) that must not be accessed by more than one process at the same time. The Critical Section Problem is the problem of de...

Full solved answer →

Multithreading models

05 marks

How does process differ with thread? Discuss at least one multithreading model with its advantages and disadvantages. [5]

Aspect Process Thread --------- Definition An independent program in execution with its own memory space A lightweight unit of execution within a process Memory Has its own separate address space Shares address space with other threads of the same process R...

Full solved answer →