logo

Crowdly

Browser

Додати до Chrome

Written 2: Obligatory Synchronization and Multithreading Programming Questions (...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Written 2: Obligatory Synchronization and Multithreading Programming Questions (27 marks)

Note: This question involves coding so it may better to not spend too long working on it without reading the other questions! Also part a and b are separate questions.

Part a 18 marks) 

Suppose the Memory Management Unit stores records of each processes' base and limit value per Unit 5A. These structures are stored in three different queues: an OS process queue, a high priority queue, and a low priority queue.

Write pseudocode to find the average allocated memory of all processes. Pseudocode is fine as well as using shorthand like "<insert all relevant headers>" or changing functions to be easier to deal with.

You may assume the following struct is used or develop your own: 

struct node{

   int base;

   int limit; 

   int process_id;

   node* next; //A link to the next node

   node* back; //A link to the previous node.

}

Part b 9 marks)

The nuclear reactor that powers Wombat OS' machine learning core has three processes that manages its runtime. You are asked to ensure that process 1 runs its statement 1 (e.g., initialize the reactor) first, then process 2 runs statement 2 (e.g., fill the reactor with water), then process 3 run statement 3 (e.g., run the reactor) using synchronization tools. Any out of sequence running of these statements would result in an explosion (e.g., Statement 3 runs before Statement 1).  No justification for your code is necessary but it may help for marking. Pseudocode is fine as well as notation like

P1:

   dothing(value) //Do a thing related to unit 4.

   S1 //This run statements 1

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на learn.twu.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome