Skip to document

OSY216D 2021 S1 A1 -MEMO

xxx
Course

OPERATING SYSTEMS III (OSY301T)

7 Documents
Students shared 7 documents in this course
Academic year: 2021/2022
Uploaded by:
0followers
11Uploads
1upvotes

Comments

Please sign in or register to post comments.

Preview text

Faculty of Information and Communication

Technology

Department of Information Technology

Operating Systems 226R

OSY216D Assignment 1 MEMO

Due Date: 21 June 2021 at 13:

SPECIAL REQUIREMENTS : Submit a typped neat report

INSTRUCTIONS TO CANDIDATES: Answer all the questions

NUMBER OF PAGES: 3 APPENDIX: 0

COURSE/S:

DIPLOMA IN

INFORMATION TECHNOLOGY

EXAMINER Dr. M. MIGABO

MODERATOR Mr. N. MATANGA

TOTAL MARKS: 40 FULL MARKS: 40

Question 1 – Introduction to Operating System [23]

  1. By means of well-selected examples, explain the two main functions of an operating system. (4)

The two major functions of an operating system are: a) Providing the users of a computer system with an extended machine. A typical example is the fact that the operating system masks or hides the details of the Hardware form the programmers and general users and provides a convenient interface for using the system. The program that hides the truth about the hardware from the user and presents a nice simple view of named files that can be read and written is of course the operating system. In this view the function of OS is to present the user with the equivalent of an extended machine or virtual machine that is easier to program than underlying hardware. Just as the operating system shields the user from the disk hardware and presents a simple file-oriented interface, it also conceals a lot of unpleasant business concerning interrupts, timers, memory management and other low-level features. b) Managing the Input/Output (I/O) devices and other resources. A typical example of the OS as resource manager is to provide for an orderly and controlled allocation of the processors, memories, and I/O devices among the various programs competing for them. Two applications running at the same time both need access to the CPU and to memory. The OS defines the access protocol to this resource.

  1. Using two examples, differentiate between timesharing and multiprogramming systems. (4)

In a timesharing system, multiple users can access and perform computations on a computing system simultaneously using their own terminals. An example is a Linux OS running on a filesharing server within an organization. Multiple users might remotely access the server to drop or copy files from it at the same time. On the other side, in a multiprogramming system, a user is allowed to run multiple programs simultaneously. This is the case of an OS running on a personal computer (PC) which allows a user to simultaneously run Microsoft word and outlook mail for example.

In short, all timesharing systems are multiprogramming systems but not all multiprogramming systems are timesharing systems since a multiprogramming system may run on a computer system with only one user.

  1. Consider a system that has two CPUs, each CPU having two threads (hyperthreading). Suppose three programs, P0, P1, and P2, are started with run times of 5, 10 and 20 msec, respectively. How long will it take to complete the execution of these programs? Assume that all three programs are 100% CPU bound, do not block during execution, and do not change CPUs once assigned. (5)

It may take 20, 25 or 30 msec to complete the execution of these programs depending on how the operating system schedules them. - If P0 and P1 are scheduled on the same CPU and P2 is scheduled on the other CPU, it will take max(5+10,20)=20 msec (separate CPUs). - If P0 and P2 are scheduled on the same CPU and P1 is scheduled on the other CPU, it will take max(5+20,10)=25 ms - If P1 and P2 are scheduled on the same CPU and P0 is scheduled on the other CPU, it will take max(10+20,5)=30 msec. - If all three are scheduled on the same CPU, it will take (5+10+20) ms= msec.

0 mark for the correct formula each time

  1. Which of the following instructions should be allowed only in kernel mode? (1) (a) Disable all interrupts. (b) Read the time-of-day clock. (c) Set the time-of-day clock. (d) Change the memory map.

Answers are: (a), (c) and (d). They should be restricted to kernel mode.

Question 2 – PROCESSES AND THREADS [17]

  1. Draw a diagram showing the three process states of an Operating System. In theory, with three states, there could be six transitions, two out of each state. However, only four transitions are shown. Are there any circumstances in which either or both of the missing transitions might occur? (5)

The transition from blocked to running is conceivable. Suppose that a process is blocked on I/O and the I/O finishes (completes its execution). If the CPU is otherwise idle, the process could go directly from blocked to running. The other missing transition, from ready to blocked state, is impossible. A ready process cannot do I/O or anything else that might block it. Only a running process can block.

  1. When an interrupt or a system call transfers control to the operating system, a kernel stack area separate from the stack of the interrupted process is generally used. Why? (4)

There are several reasons for using a separate stack for the kernel. Two of them are as follows:

  • Safe Applications exit: First, you do not want the operating system to crash because a poorly written user program does not allow for enough stack space.
  • Security: Second, if the kernel leaves stack data in a user program’s memory space upon return from a system call, a malicious user might be able to use this data to find out information about the other processes.
Was this document helpful?

OSY216D 2021 S1 A1 -MEMO

Course: OPERATING SYSTEMS III (OSY301T)

7 Documents
Students shared 7 documents in this course
Was this document helpful?
OSY216D
S1, 2021
Assignment 1
Page 1 of 3
Faculty of Information and Communication
Technology
Department of Information Technology
Operating Systems 226R
OSY216D Assignment 1 MEMO
Due Date: 21 June 2021 at 13:00
SPECIAL REQUIREMENTS : Submit a typped neat report
INSTRUCTIONS TO CANDIDATES: Answer all the questions
NUMBER OF PAGES: 3
APPENDIX: 0
COURSE/S:
DIPLOMA IN
INFORMATION TECHNOLOGY
EXAMINER
Dr. M.E. MIGABO
MODERATOR
Mr. N.Y. MATANGA
TOTAL MARKS: 40
FULL MARKS: 40