CS703 Assignment 2
CS703 Assignment 2
Assignment 2
Instructions
1. Due Date: Friday, April 18th, 2025.
2. Please write your own solutions.
Questions
Please use the answer sheet provided to write all your answers.
2. The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process.
Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker
needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has
tobacco, and the third has matches. The agent has an infinite supply of all three materials. The agent places
two of the ingredients on the table. The smoker who has the remaining ingredient then makes and smokes a
cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients,
and the cycle repeats. Write a program to synchronize the agent and the smokers.
In your solution, first define the semaphores that you need, give their initial values. Then write pseudo-code
for 4 processes, 1 for the agent, and 1 for each smoker.
4. Considering a 16 bits system, use a linear translate page table with the following assumptions:
• The page size is 32 bytes;
• The virtual address space for the process is 512 pages or 16KB;
• Physical Memory consists of 128 pages.
• Every entry in the page table has one extra VALID bit
• Page entry per page is 32 PTEs.
a) Please design this linear translate page table in detail, including the format of the PTE and
virtual/physical address and the meaning of each part.
b) Is this page table effective? If not, how to improve it? Describe the improved page table in detail.