CSC2404 Operating Systems Assignment

Assignment Help Other Subject
Reference no: EM132621574

CSC2404 Operating Systems Assignment - University of Southern Queensland, Australia

This assignment consists of 4 questions.

Question 1 - Answer the following questions:

a. Given five memory partitions (in order) of 100 KiB, 500 KiB, 200 KiB, 300 KiB, and 600 KiB, how would each of the first-fit, best-fit, and worst-fit algorithms place processes (in or-der) of 212 KiB, 417 KiB, 112 KiB, and 426 KiB? Which algorithm makes the most efficient use of memory?

b. Assume a 32 bit system, with a 2-level page table, with a page size of 4KiB (p1=10bits, p2=10bits, offset=12bits).

(i) A program on this system requires 16MiB in total: the program text segment uses 4MiB, the program data re-quires 2MiB, the program dynamically allocates 8MiB on the heap, and the stack utilises 2MiB.

How many page-table pages are required for this process? (Don't answer with just a number, explain your reasoning. Without your reasoning we cannot award part marks if your answer is incorrect.)

(ii) Describe the lookup steps within the page tables to find the physical address of the logical address 0x00403004.

(iii) If the reference time to access the physical memory frame is 20 nanoseconds. Assume that all required pages are in memory. How long does a paged memory reference take, if-

i. There is no TLB?

ii. There is a TLB, with an access speed of 0.05 nanoseconds, but the TLB does not contain information on the required page?

iii. There is a TLB, with an access speed of 0.05 nanoseconds, and the TLB contains information on this page?

(Do not answer with just a number, explain your reasoning.)

Question 2 - A file is to be shared among different processes. The file can be accessed simultaneously by more than one process, up to a maxi-mum of 9 processes. In pseudo-code write a monitor to coordinate access to the file.

For example:

FileMonitor M;

int main() {

...

M.RequestAccess();

/* Access file: open, read, close, etc. */

M.FinishedAccess();

...

}

Monitor FileMonitor {

/* monitor variables here */

void RequestAccess() { /* Code here */ }

void FinishedAccess() { /* Code here */ }

}

The monitor pseudo-code needs to define monitor variables and the monitor functions.

Notes

This is pseudo-code and not meant to be compiled and run. You will need to check the logic though.

This is a monitor so mutual-exclusion is assured and does not need to be incorporated in the code.

Assume that the monitor uses Mesa condition variables.

As a starting point study Figure 6.14 (Ed. 9 Figure 5.19) from the text book (Operating System Concepts, Silberschatz et el.).

Question 3 - Consider a program modelling a railway marshalling yard with two sidings: one siding is for Container Wagons and one is for Coal Trucks.

The program has one Engine thread, and potentially many Wagon threads (one for each wagon) and potentially many Truck threads (one for each truck).

The Engine thread waits until there are sufficient Wagons or Trucks to shunt. The Engine thread calls the method shuntWagons() if Wagons are to be shunted and/or the method shuntTrucks() if Trucks are to be shunted.

For efficiency and because of the design of the yard the shunting engine will wait until there are 15 Container Wagons to move and/or there are 10 Coal Trucks to move.

In pseudo-code, and using semaphores for synchronisation, write the procedureEngineThread()that will call the pre-written proce-dures:shuntTrucks()andshuntWagons(). Also write the proce-duresWagonThread()andTruckThread(), that need to wake-up the Engine thread when there are sufficient trucks or wagons to shunt.

As a starting point use the code below.

Remember: All Semaphores and variables must be initialised. The pseudo-code below declares variables, but it does not initialise them.

Question 4 - Consider the following pseudo-code:

/* Global memory area accessible by threads */

#define N 100

struct frame *emptyStack[N];

struct frame *displayQueue[N];

int main() {

/*

** Initialise by allocating the memory for N frames

** And place the N frame addresses into the

** empty Stack array

*/

Initialise();

thread_t tid1, tid2;

threadCreate(&tid1, GetFrame);

threadCreate(&tid2, ShowFrame);

sleep(300);

}

GetFrame() {

struct frame *frame;

struct frame local;

while (1) {

CameraGrab(&local); /* get a frame from the camera store it in local */

frame = Pop(); /* pop an empty-frame address from the empty stack */

CopyFrame(&local, frame); /* copy data from the local frame to the frame address */

Enqueue(frame); /* push the frame address to } the display queue */

}

ShowFrame() {

struct frame *frame;

struct frame local;

struct frame filtered;

while (1) {

frame=Dequeue(); /* pop the leading full frame

from the full queue */

CopyFrame(frame, &local); /* copy data to the local frame */

Push(frame); /* push the frame address to the empty stack */

Solarise(&filtered, &local); /* Modify the image */

VideoDisplay(&filtered); /* display the image */

}

}

This program creates two threads, one callsGetFrame(), which continually grabs frames from a camera, and the other thread calls ShowFrame(), which continually displays the frames (after modi-fication). When the program starts theemptyStackcontains the addresses of N empty frames in memory.

The process runs for 5 minutes displaying the contents from the camera.

The proceduresPop()andPush()are maintaining the list of frame addresses on the empty stack. Pop()removes a frame memory address from the empty stack, andPush()adds a memory address to the empty stack.

The proceduresDequeue() and Enqueue() are maintaining the list of frame memory addresses in the display queue in display order. Dequeue()removes the memory address of the next frame to display from the display queue, andEnqueue()adds a memory address to the end of the display queue.

The stack and the queue are the same size, and are large enough to contain all available frame memory addresses.

a. Without including synchronisation code problems will occur. Discuss what could potentially go wrong?

b. Identify the critical sections in the above pseudo-code.

c. Modify the above pseudo-code using semaphores only, to en-sure that problems will not occur.

Hint: this is a variation on the Producer-Consumer problem and will require similar semaphores.

Attachment:- Operating Systems Assignment File.rar

Reference no: EM132621574

Questions Cloud

How much was collected on account during the period : Bravo' sold goods on account for $1,400. Ending Accounts Receivable had a $630 balance. How much was collected on account during the period?
Define acidic and basic dyes : -Why do you think the presence of grease or dirt on a glass slide will result in a poor smear preparation? Cite two or three reasons.
Define concept of social support : Define the concept of social support. Define and explain the four types of social support and provide an example of each type of support.
How much will the retained earnings balance become : If the firm issues the 10% stock dividend, how much will the retained earnings balance become? How much will total equity become?
CSC2404 Operating Systems Assignment : CSC2404 Operating Systems Assignment Help and Solution - University of Southern Queensland, USQ, Australia - Assessment Writing Service
Identify the philosophical principles behind business ethics : Explain how values relate to ethics; identify factors contributing to lax ethics and common ethical temptations and violations;
Performance of the simple staining procedure : During the performance of the simple staining procedure, you failed to heat fix your E. coli smear preparation.
Express the fixed and variable components as a linear cost : Establish the fixed and variable components of total maintenance cost? Express the fixed and variable components as a linear cost formula?
Define refractive index : 1. Define resolution. 2. What is the name of the part of the microscope that holds the objectives?

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd