+ All Categories
Home > Documents > Web view1(a) Operating system is a low software that supports a computer’s basic functions such as...

Web view1(a) Operating system is a low software that supports a computer’s basic functions such as...

Date post: 10-Aug-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
15
INFORMATION AND COMMUNICATIONS UNIVERSITY SCHOOL OF ENGINEERING. OPERATING SYSTEM An assignment submitted in partial fulfillment of the requirements for the BA Degree in information and communications in networks Assignment No. 1 Student details BANDA MASAUSO Student Number 1508330432 Year : 2020
Transcript
Page 1: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

INFORMATION AND COMMUNICATIONS UNIVERSITY

SCHOOL OF ENGINEERING.

OPERATING SYSTEM

An assignment submitted in partial fulfillment of the requirements for the BA Degree in information and communications in networks

Assignment No. 1

Student details BANDA MASAUSO

Student Number 1508330432 Year : 2020

ASSIGNMENT IS DUE ON 20th May 2020

Page 2: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

Q. 1.

a) Define the term “Operating system” and three (3) give some examples? (5 marks) b) Have modern operating system functions, such as “concurrency” improved the performance of computers? (10marks) c) Critically evaluate the services offered by modern operating systems such as Windows 7. (10 marks)

Total 25 marks

ANSWER FOR Q.1

1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals.

Examples of Operating system are:

Microsoft Windows(Windows 10,Windows 8, Windows 7)

Apples Mac OS (formerly OS X),Chrome OS, Blackberry Tablet OS

Linux flavors of the open source operating system.

(b) In computing multi tasking is the concurrent execution of multitasks also known as process over a certain period of time new tasks can interrupt already started one before they finish. Instead of waiting for them to end as a result a computer executes signals of multiple tasks in an interned manner, while the tasks share common processing recourses such as Central Processing Units and main memory.

(c) Context switching and scheduling, which allocate a process CPU time to execute its instructions Memory Management which deals with allocating memory to processes. Inter process Communication, which deals with facilities to allow concurrently running processes to communicate with each other file systems which provide higher level files

out of low level unstructured data on a disk.

High level 1/0 facilities, which free a process from the low-level detains of interrupt.

Q. 2.

Page 3: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

a) What is CPU scheduling? and give one (1) example (5 marks) b) Distinguish between Preemptive and Non-Preemptive Scheduling (5 marks) c) Critically access the scheduling criteria. (5 marks) d) Discuss the general goals of CPU scheduling. (10 marks) Total 25 marks

ANSWER FOR Q.2

(a) In Computing scheduling is the method by which work is assigned to resources that complete the work. The work may be virtual computation elements such sd threads processes or data flows, which are in turn scheduled onto hardware resources such as Processors, Network links or expansion cards.

(b)The basic difference between preemptive and non preemptive scheduling is that in preemptive scheduling the CPU is allocated to the processes for the limited time while in non – preemptive scheduling, the CPU is allocated to the process till it terminates or switches to waiting state.

(c) A CPU scheduling algoritnon tries to Maximize and Minimize the following:

MAXIMUMZE

CPU utilization: CPU utilization is the main task which the operating system needs to make sure the CPU remains as busy as possible. It can range from 0-100 percent. However, for the RTOS, it can be range from 40 period for low-level and 90 percent for the high level system.

Though put: The number of processes that finish their execution percent time is known throughput. So when the CPU is busy executes the process at the time, work is being done and the work completed percent Unit time Called Throughput.

MININIZEWaiting time: waiting time is an amount that specific process needs to wait in the ready quene.

Response time: it is an amount of time in which the request was submitted until the first response is produced.

Turn Around Time: minimizes the time between submission and termination.

Q. 3.

Page 4: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

a) What is a process? give three (3) examples (5 marks) b) Apart from normal exit, how can processes terminate? (8 marks) c) Discuss the various process operations, clearly stating what is involved in each process operation. (12 marks)

Total 25 marks

ANSWER FOR Q.3

A process is a series of actions or steps taken in order io achieve a particular end.

(b) A process can be terminated abnormally for a number of reasons ultimately, all of these reasons will result in a signals being set on the processes. A signal is something that can interrupt the flow of your threads at anytime. The deferent action for most signals is to terminate the process.

(c) PROCESS CREATION: Process creation is a task of creating new processes.

There are different situations in which a new process is created. A new process can be created at the time of initialization of operating system or when systems calls such as fork are initiated by other processes. The process ,which creates a new process using system calls is called parent process while the new process that is created is called child process. The child process can create new process using system calls. A new process can also create by an operating system based on the request received from the user.

The process creation is very common in running computer system because corresponds to very task that is performed there is a processes associated with it.for instance a new process is created every time a user logs on to a computer system,an application programme such as ms word is initiated, or when a document printed.

PROCESS TERMINATION.

Process termination is an operation in which a process is terminated after the execution of its last instruction .This operation is used to terminate or end any process when a process is terminated, the resources that were being utilized by the process are released by the operating system. When a child process terminates, it sends the status information back to the parent process before terminating.

The child process can also be terminated by the parent process if the task performed by the child process is no longer needed. In addition, when a parent process terminates it has to terminate the child process as well because a child process can not run when its parent process has been terminated.

Q.4.

Page 5: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

a) Describe the following scheduling algorithms (9 marks)

• Non Pre-Emptive, First Come, First Serve

• Round Robin

• Shortest Job First

b) Given the following processes and burst times

Process Burst Time

P1 10

P2 6

P3 23

P4 9

P5 31

P6 3

P7 19

Calculate the average wait time when each of the above scheduling algorithms is used?

Assume that a quantum of 8 is being used. (12marks)

c) Which scheduling algorithm, as an operating systems designer, would you implement?

(4 marks)

Total 25 marks

ANSWER FOR Q .4

(a) To decide which process to execute first and which process to execute last to achieve maximum cpu utilization, computer scientists.

- Non pre preemptive is used when a process terminates or a process switches from running to waiting state in this scheduling, once the resources (cpu cycles) is allocated to a process, the process holds the cpu till it gets terminated or it reaches a waiting state. In case of non preemptive scheduling does not interrupt a process running cpu in middle of the execution.

Page 6: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

instead it waits till the process complete its cpu burst time and then it can allocate the cpu to another process.

- In the first come first serve scheduling algorithm ,as the it suggests, the process which arrives first, gets executed first,or we can say that the process which requests the cpu first, gets the cpu allocated firsts.

- First come first serve is just like FIFO(first in first out) queue data structure, where the element which is added to the queue first is the one who leaves the queue first.

- Round Robin is a cpu scheduling algorithm where each process is assigned a fixed time slot in a cyclic way.

- It is simple to implement and starvation free as all processes get fair share of cpu.- Shortest Job First is scheduling algorithm in which the process with the smallest execution

time is selected for execution next.shortest job first can be either preemptive or non preemptive.it also reduces the average waiting time for other processes awaiting execution.

(b)First come first save

Round robin quantum of 8

Page 7: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:
Page 8: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

(c) The implement RR scheduling, we keep the ready queue as a FIFO queue of processes. New processes are added to the tail of the ready queue. The cpu scheduler picks the first process from the ready queue, sets a timer to the interrupt after 1 time quantum, and dispatches the process

Q. 5. a) What roles does a command interpreter play in an operating system? (5 marks) b) Discuss the various roles systems calls are responsible for in operating systems. (9 marks) c) Evaluate the concept of interrupts and interrupts handling. (11 marks) Total 25 marks

Page 9: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

ANSWER FOR Q .5

(a) The command interpreter reads the commands that a user types at a terminal interprets them and translate them into a detailed set of instructions that the computer hardware can understand. It varies from one OS to another. Every OS must provide command interpreter of its operation.

(b)System calls provide the service of the operating system to the user programs via application program interface(API). It provides an interface between a process and operating system to allow user level processes to request services of the operating system. System calls are the only entry points into the kernel system.(c)Interrupt handlers are no nested. The interrupts are disabled until control is returned back to the interrupted task or process because a no nested interrupted handler can only service a single interrupt at a time, handlers of this form are not suitable for complex embedded systems that service multiple interrupt with differing priority levels.- Disable/Interrupts: when the IRQ exception is raised the ram processor will disable further IRQ exceptions from occurring. The processor mode is set to the appropriate interrupt request mode and the previous cpsr is copied in to the newly available spsr (interrupted request mode).The processor will then set the pc to point to the correct entry in the vector table and execute the instruction. This instruction will alter the pc to point to the specific interrupt handler.

-Save context: on entry the handlers code saves a subnet of the correct processor mode non balanced registers.- Interrupt handler: The handler then identifies the external interrupts source and executes the appropriate interrupt service routine(ISR).-Interrupt service routine: The IRS service the external interrupt force and resets the interrupt.- Restore Context: The ISR returns back to the interrupt handler which restores in the context.-Enable Interrupts finally to rerun from interrupt handler the spsr(interrupt request mode)is restored back into the cpsr. The pc is then set to the next instruction after the interrupt was raised.

Q.6.

a) The buddy system is a memory management scheme that uses variable sized partitions. Explain the basic principle behind the buddy system. (5 marks)

b) Assume a computer with a memory size of 256K, initially empty. Requests are received for blocks of memory of 5K, 25K, 35K and 20K. Show how the buddy system would deal with each request, showing the memory layout at each stage and the status of the lists at the end. After allocating all the processes, what would be the effect of the 25K process terminating and returning its memory? (10 marks) c) Describe and evaluate an alternative to the buddy system (10 marks)

Page 10: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

Total 25 marks

ANSWER FOR Q .6.If we keep a lists of holes in memory sorted by their size, we can make allocation to processes very fast as we only need to search down the list until we find a hole that is big enough.The problem is that when a process ends the maintenance of the list is complicated. In particular, merging adjacent holes is difficult as the list has to be searched in order to find its neighbors.(a)The buddy system is a memory allocation that works on the basis of using binary numbers as these are fast for computers to manipulate.

Lists are maintained which stores lists of free memory blocks sizes 1,2,4,8……….,n where n is the size of memory in bytes. this means that for a 256k memory we require 19 lists.If we assume we have 256k of memory and it is all unused then there will be one entry in the 256k lists and all other lists will be empty.

Page 11: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

Q. 7. a) What is a deadlock? (2 marks) b) Identify the strategies modern operating systems use to deal with deadlocks. (5 marks) c) Critically assess the effectiveness of the ostrich approach. (8 marks) d) Examine the efficiency the various recovery algorithms used in deadlock handling. (10 marks) Total 25 marks

ANSWER FOR Q .7

(a) A deadlock refers to a specific condition when two or more processes are each waiting for another to release a resource, or more than two processes are waiting for a resources in a circular chain.

(b) Just ignore the problemDetection and recoveryDynamic avoidance by careful resource allocation.Mutual exclusionCircular wait.

(c) It is used when it is more cost-effective to allow the problem to occur than to attempt its prevention.Pretend there is no problemReasonable if deadlocks occur very rarelyCost of prevention is high, example of cost..only one process runs at a time.

(d) When a Algorithm determines that a deadlock has occurred in the system, the system must recover from that deadlock. There are two approaches of breaking a Deadlock:

1. Process Termination:To eliminate the deadlock, we can simply kill one or more processes. For this, we use two methods:

(a). Abort all the Deadlocked Processes:Aborting all the processes will certainly break the deadlock, but with a great expenses. The deadlocked processes may have computed for a long time and the result of those partial computations must be discarded and there is a probability to recalculate them later.

(b). Abort one process at a time until deadlock is eliminated:Abort one deadlocked process at a time, until deadlock cycle is eliminated from the system. Due

Page 12: Web view1(a) Operating system is a low software that supports a computer’s basic functions such as scheduling tasks and controlling peripherals. Examples of Operating system are:

to this method, there may be considerable overhead, because after aborting each process, we have to run deadlock detection algorithm to check whether any processes are still deadlocked.

2. Resource Pre-emption:To eliminate deadlocks using resource pre-emption, we pre-empt some resources from processes and give those resources to other processes. This method will raise three issues –

(a). Selecting a victim:We must determine which resources and which processes are to be preempted and also the order to minimize the cost.

(b). Rollback:We must determine what should be done with the process from which resources are preempted. One simple idea is total rollback. That means abort the process and restart it.

(c). Starvation:In a system, it may happen that same process is always picked as a victim. As a result, that process will never complete its designated task. This situation is called Starvation and must be avoided. One solution is that a process must be picked as a victim only a finite number of times


Recommended