Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech III CONCURRENT PROGRAMMING Previous Question Paper (August - 2022 - R18)

B.Tech | III | II | R18 | August - 2022

Answer PaperPaper Code: 156AMMaximum Marks: 75Time: 3 Hours

Answer any five questions

All questions carry equal marks

Main

115 marks
a

Explain Lamport’s Bakery Algorithm with example.

7 marks

Answer

Lamport’s Bakery Algorithm is a software-based solution for the mutual exclusion problem among n processes. It mimics the process of taking a ticket at a bakery, where each process is assigned a number, and the process with the lowest number enters the critical section first.

The algorithm uses two shared arrays: choosing (a boolean array) and number (an integer array). When a process i wants to enter the critical section, it performs the following steps:

  1. It sets choosing[i] to true and finds the maximum value in the number array, then sets its own number[i] to max(number[0], ..., number[n-1]) + 1.
  2. It sets choosing[i] to false.
  3. For every other process j, it waits until choosing[j] is false and then checks if number[j] is zero or if the pair (number[j], j) is lexicographically greater than (number[i], i).

If two processes pick the same number, the process with the smaller PID (index) is given priority, ensuring no two processes enter the critical section simultaneously while preventing starvation.

b

Define mutual exclusion and critical section with examples.

8 marks

Answer

Mutual Exclusion is a property of concurrency control that ensures that if one process is executing in its critical section, no other process is allowed to execute in its critical section. This prevents race conditions and data inconsistency.

Critical Section is the segment of code within a process where the process accesses shared resources, such as variables, files, or hardware devices, that must not be accessed by more than one process at a time.

For example, in a banking application, the code block that updates a shared account balance is a critical section. If two processes attempt to update the balance simultaneously without mutual exclusion, a 'lost update' problem occurs where one transaction overwrites the other. By enforcing mutual exclusion, the system ensures that the read-modify-write cycle for the balance is performed atomically by only one process at a time.

215 marks
a

Discuss briefly about producer and consumer problem.

8 marks

Answer

Sign in to view the complete answer paper.

b

What are the Harsh Realities of Parallelization?

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Discuss the java memory model in detail.

8 marks

Answer

Sign in to view the complete answer paper.

b

What are the dependent progress conditions?

7 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

What is the importance of sequential objects in concurrent objects?

7 marks

Answer

Sign in to view the complete answer paper.

b

Write algorithm on a lock-based FIFO queue.

8 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Define States and Valence with examples.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain importance of decide() method in Consensus Numbers.

8 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Explain in brief about working of spin locks.

8 marks

Answer

Sign in to view the complete answer paper.

b

What is the mechanism of test and set locks?

7 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Compare Lazy Synchronization and Non-Blocking Synchronization.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write the Role of Locking in linked lists.

7 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Write about a Bounded Partial Queue and an Unbounded Total Queue.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain in brief about Naive Synchronous Queue.

7 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of CONCURRENT PROGRAMMING from Jawaharlal Nehru Technological University Hyderabad for B.Tech CSE III II, August - 2022, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in CONCURRENT PROGRAMMING

Loading Question Papers

Fetching data from database...