Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The issue of resource utilization shows up in different forms in different ty

ID: 3684786 • Letter: 1

Question

1. The issue of resource utilization shows up in different forms in different types of
operating systems. List what resources must be managed carefully in the following settings:
(10%)
a. Sever systems
b. Chrome Book
c. smartphone


2. Run ps with –u option and show what is your current terminal type, the pid of ps
command and parent pid of it. (10%)


3. Enter the following commands and report your observation. (10%)
a. who and tty
b. tput clear
c. id
d. ps
e. echo $$


4. List five services provided by an operating system. Explain how each provides
convenience to the users. Explain also in which cases it would be impossible for user-level
programs to provide these services and how they are protected.(20%)


5) explain mechanisms that OS and hardware provides to ensure system resources and
instructions are protected. (20%)


7) Describe the actions a kernel takes to context switch between processes. (10%)


8) if you have to improve the context switch by reducing the overhead, what will you
do (hints: software or hardware solutions) (10 %)


9) issue top command on your unix/linux (e.g. sample screen below is just an
example only) and interpret what are all column across for each process (10%)

Explanation / Answer

4a) Following are the five services provided by an operating systems to the convenience of the users.

1. Program Execution

The purpose of a computer systems is to allow the user to execute programs. So the operating systems provides an environment where the user can conveniently run programs. The user does not have to worry about the memory allocation or multitasking or anything. These things are taken care of by the operating systems.

Running a program involves the allocating and deallocating memory, CPU scheduling in case of multiprocess. These functions cannot be given to the user-level programs. So user-level programs cannot help the user to run programs independently without the help from operating systems.

2. I/O Operations

Each program requires an input and produces output. This involves the use of I/O. The operating systems hides the user the details of underlying hardware for the I/O. All the user sees is that the I/O has been performed without any details. So the operating systems by providing I/O makes it convenient for the users to run programs.

For efficiently and protection users cannot control I/O so this service cannot be provided by user-level programs.

3. File System Manipulation

The output of a program may need to be written into new files or input taken from some files. The operating systems provides this service. The user does not have to worry about secondary storage management. User gives a command for reading or writing to a file and sees his her task accomplished. Thus operating systems makes it easier for user programs to accomplished their task.

This service involves secondary storage management. The speed of I/O that depends on secondary storage management is critical to the speed of many programs and hence I think it is best relegated to the operating systems to manage it than giving individual users the control of it. It is not difficult for the user-level programs to provide these services but for above mentioned reasons it is best if this service s left with operating system.

4. Communications

There are instances where processes need to communicate with each other to exchange information. It may be between processes running on the same computer or running on the different computers. By providing this service the operating system relieves the user of the worry of passing messages between processes. In case where the messages need to be passed to processes on the other computers through a network it can be done by the user programs. The user program may be customized to the specifics of the hardware through which the message transits and provides the service interface to the operating system.

5. Error Detection

An error is one part of the system may cause malfunctioning of the complete system. To avoid such a situation the operating system constantly monitors the system for detecting the errors. This relieves the user of the worry of errors propagating to various part of the system and causing malfunctioning.

This service cannot allowed to be handled by user programs because it involves monitoring and in cases altering area of memory or deallocation of memory for a faulty process. Or may be relinquishing the CPU of a process that goes into an infinite loop. These tasks are too critical to be handed over to the user programs. A user program if given these privileges can interfere with the correct (normal) operation of the operating systems.

7a) A context switch consists of saving the state of the current process and restoring the state of the process. The process state of the current process is changed to ready (as in, ready to be continued) and the next process state is changed to running (to indicate is currently being executed). This action is pure overhead as no useful work is actually performed.

8a) To control the execution of processes, the kernel must be able to suspend the execution of the process running on the CPU and resume the execution of some other process previously suspended. This activity goes by the names process switch, task switch, or context switch. A context switch can be voluntary - where a process either completes its task before its allotted time slice is over or enters a suspended state because it makes a blocking IO call.

Alternatively a context switch can be involuntary wherein if a process exhausts the cpu time slice allotted to it the kernel will pre-empt the process and switch it out to grant cpu time to another process in the run queue. The suspension of the first process and scheduling of the second one requires the kernel to store the state of the first process and load the state of the second one. The overhead and time required for the same is referred to as context switching overhead.

The count of voluntary context switches of a process can be used to infer the frequency of blocking calls of a process. Involuntary context switches on the other hand signify processes contending for the cpu and having to be switched out even though their task had not completed.

9a) The top program provides a dynamic real-time view of a running system. It can display system summary information, as well as a list ofprocesses or threads currently being managed by the kernel. The types of system summary information shown and the types, order and size of information displayed for tasks are all user-configurable.

top syntax :