You are on page 1of 13

Faculty of Management and Business Technology

Assignment ____1____ (Individual)

Student Name TAN CHUAN LIANG

Student ID 00000100258

Program DIPLOMA IN Information Technology

Semester January 2020

Course Operating System

Course Code EDI 113

Assignment Instructions
1. Students are to ensure all work done are NOT plagiarized and are properly referenced.
2. Students must use this designated cover sheet when handing in assignments.
3. Use the above page as your first page.
 Your answer for each question should not exceed 500 words.
 Use appropriate diagrams if needed.
 Use the following format:
o Heading – Heading 1
o Sub heading – heading 2
o Font - Times New Roman and Size – 12, 1.5 spacing
 Any assignment submitted after the deadline will not be entertained. You will be assigned ‘0’
marks automatically.
 Submit your assignment personally to me at Block A, Level 2.
 Marks will be deducted for the assignment submitted later than the deadline.
 No hand-written assignment is accepted
 Neatly format, print your assignment and submit.

CLO: 1

Explain how computing resources (such as CPU and memory) are managed by the operating
system. (C2, PLO1)

Marks:

All question carry equal marks (10 x 10=100)

Deadline: 9th March 2020


Question

1. Discuss the role of an Operating system.

An operating system has three main functions: (1) manage the computer's resources, such as the
central processing unit, memory, disk drives, and printers, (2) establish a user interface, and (3)
execute and provide services for applications software. Keep in mind, however, that much of the
work of an operating system is hidden from the user; many necessary tasks are performed behind the
scenes. In particular, the first listed function, managing the computer's resources, is taken care of
without the user being aware of the details. Furthermore, all input and output operations, although
invoked by an applications program, are actually carried out by the operating system. Although
much of the operating system functions are hidden from view, you will know when you are using an
applications software package, and this requires that you invoke-call into action-the operating
system. Thus, you both establish a user interface and execute software.

Operating systems for mainframe and other large computers are even more complex because they
must keep track of several programs from several users all running in the same time frame. Although
some personal computer operating systems-most often found in business or learning environments-
can support multiple programs and users, most are concerned only with a single user. We begin by
focusing on the interaction between a single user and a personal computer operating system.

2. Discuss the various scheduling technique of operating system.

Long Term Scheduler:


It is also called a job scheduler. A long-term scheduler determines which programs are admitted to
the system for processing. It selects processes from the queue and loads them into memory for
execution. Process loads into the memory for CPU scheduling.

The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound
and processor bound. It also controls the degree of multiprogramming. If the degree of
multiprogramming is stable, then the average rate of process creation must be equal to the average
departure rate of processes leaving the system.
On some systems, the long-term scheduler may not be available or minimal. Time-sharing operating
systems have no long term scheduler. When a process changes the state from new to ready, then
there is use of long-term scheduler.

Short Term Scheduler:


It is also called as CPU scheduler. Its main objective is to increase system performance in
accordance with the chosen set of criteria. It is the change of ready state to running state of the
process. CPU scheduler selects a process among the processes that are ready to execute and allocates
CPU to one of them.

Short-term schedulers, also known as dispatchers, make the decision of which process to execute
next. Short-term schedulers are faster than long-term schedulers.

Medium Term Scheduler:


Medium-term scheduling is a part of swapping. It removes the processes from the memory. It
reduces the degree of multiprogramming. The medium-term scheduler is in-charge of handling the
swapped out-processes.
A running process may become suspended if it makes an I/O request. A suspended process cannot
make any progress towards completion. In this condition, to remove the process from memory and
make space for other processes, the suspended process is moved to the secondary storage. This
process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be
necessary to improve the process mix.

3. Explain deadlock with appropriate example.


Deadlock is a situation where a set of processes are blocked because each process is holding a
resource and waiting for another resource acquired by some other process.
Consider an example when two trains are coming toward each other on same track and there is
only one track, none of the trains can move once they are in front of each other. Similar situation
occurs in operating systems when there are two or more processes hold some resources and wait
for resources held by other(s). For example, in the below diagram, Process 1 is holding Resource
1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource
Example:
Program 1 requests resource A and receives it.
Program 2 requests resource B and receives it.
Program 1 requests resource B and is queued up, pending the release of B.
Program 2 requests resource A and is queued up, pending the release of A.

4. Describe briefly disk scheduling?


One of the major duties of the operating is that, to use the hardware orderly and accurately. For
disk drives, it has a duty of having a fast access time and disk bandwidth. Generally, bandwidth
is the total number of bytes, which need to be transferred, and then divided by the total time
between the first service and the last transfer. In the case of disk structure, we have to improve
both access time and the bandwidth with the help of scheduling the service of disk I/O requests
in good order. By this there are many techniques comes for disk scheduling which is prescribed
below.

1. FCFS Scheduling
This is a simple scheduling algorithm which means first come first serve form of an algorithm.
This kind of algorithm generally not provides the fastest service.
Consider the example: a disk queue with a request for I/O to blocks on cylinder 97, 182, 37, 128,
and 15 in that order. If the disk head is initially at cylinder 52, so it will first move from 52 to 97,
then 182, 37, 128, 15. There is a drastic change in the moment like 37 to 128 and then back to
15, it can generate the problem with this schedule.

2. SSTF scheduling
This is an algorithm which is termed as shortest seek time first algorithm. This type of algorithm
selects the request with the minimum seek time from the current head position, as seek time is a
time in which the arm has to move the head to the cylinder containing the desired sector. Seek
time will be increased if the number of the head will be traversed by the head, as SSTF choose
the request closest to the head position.
3. SCAN Scheduling
SCAN scheduling algorithm is also called the elevator algorithm because in such kind of
algorithm arm behaves just like an elevator for building the way. In the SCAN algorithm, the arm
will start at the one end of the disk and then move towards another end of the disk. At the last
end, the head of the arm will be reversed and then this process continues.

4. C-SCAN Scheduling
This kind of algorithm is termed as circular scan scheduling algorithm. This is designed to
provide a uniform wait time. The C-SCAN algorithm treats the cylinder as the circular lists
which will wrap the final cylinder to the first one. Although it is same as SCAN, in this also the
head will move from one end to the another, when the head reaches the end it immediately return
at a position of the beginning of the disk, without any request.

5. LOOK scheduling
This is the same as a SCAN algorithm, this algorithm kindly check the LOOKS to see whether
there is any request which is pending in the direction of a head moment. Generally, according to
the LOOK algorithm, the arm goes only as far as possible in each direction and then reverse
direction without going to the end. The variant like scan is called LOOK scheduling because at
last, they will look for a request before to move in a given direction.

5. What are the uses of file allocation table?

A file allocation table (FAT) is a file system developed for hard drives that originally used 12 or 16
bits for each cluster entry into the file allocation table. It is used by the operating system (OS) to
manage files on hard drives and other computer systems. It is often also found on in flash memory,
digital cameras and portable devices. It is used to store file information and extend the life of a hard
drive.
Most hard drives require a process known as seeking; this is the actual physical searching and
positioning of the read/write head of the drive. The FAT file system was designed to reduce the
amount of seeking and thus minimize the wear and tear on the hard disc.
FAT was designed to support hard drives and subdirectories. The earlier FAT12 had a cluster
addresses to 12-bit values with up to 4078 clusters; it allowed up to 4084 clusters with UNIX. The
more efficient FAT16 increased to 16-bit cluster address allowing up to 65,517 clusters per volume,
512-byte clusters with 32MB of space, and had a larger file system; with the four sectors it was
2,048 bytes.

6. How Virtual Memory helps in allocating more spaces?


Virtual memory is a common part of most operating systems on desktop computers. It has
become so common because it provides a big benefit for users at a very low cost.

In this article, you will learn exactly what virtual memory is, what your computer uses it for and
how to configure it on your own machine to achieve optimal performance.

Windows 98 is an example of a typical operating system that has virtual memory. Windows 98
has an intelligent virtual memory manager that uses a default setting to help Windows allocate
hard drive space for virtual memory as needed. For most circumstances, this should meet your
needs, but you may want to manually configure virtual memory, especially if you have more than
one physical hard drive or speed-critical applications.

To do this, open the "Control Panel" window and double-click on the "System" icon. The system
dialog window will open. Click on the "Performance" tab and then click on the "Virtual
Memory" button.

7. What is swapping?

Swapping is one of the several methods of memory management. In swapping an idle or a blocked
process in the main memory is swapped out to the backing store (disk) and the process that is ready
for execution in the disk, is swapped in main memory for execution. We will be discussing swapping
in more detail.

As we all know, a process must be placed in main memory for its execution. But the fact is that we
have a limited amount of main memory. The memory needed by all the processes in the system is
often more than the main memory we have in the system.
Consider a real-time example:
In Windows operating system, as soon as the system is booted 50-100 process starts executing, these
processes do nothing but check for application updates. Such processes take up to 5-10 MB memory
space. The other processes start checking for the incoming network, incoming mails and the other
things.

This all happens before a user has started any process. A single user application nowadays takes
about 500 MB of memory space just to start up. So, keeping all these processes in main memory
would require a large amount of main memory. And the increasing the size of main memory would
increase the cost of the system. To deal with these memory overloads we have come up with the two
approaches, swapping and virtual memory.

8. Explain directory structure used in operating system for storing files

Several users create thousands and millions of files in a file system. To organize these files properly
file system uses directory structure. The directory structure has the entries of the all the files related
to that directory. We can consider that a directory is a file, that contains information about the other
files.
Single-level directory structure
Single level directory structure has only one directory which is called the root directory. The users
are not allowed to create subdirectories under the root directory. All the files created by the several
users are present in the root directory only.
As you can see in the diagram below all the file F1, F2, F3, F4 created by the different users are
present at the root directory.
Two-level directory structure
In Two-level directory structure, the users create directory directly inside the root directory. But once
a user creates such directory, further he cannot create any subdirectory inside that directory. Observe
the figure below, 4 users have created their separate directory inside the root directory. But further,
no subdirectory is created by the users.

This two-level structure allows each user to keep their files separately inside their own directory.
This structure allows to use the same name for the files but under different user directories.

Tree Directory Structure


In a tree directory structure, except root directory, every directory or file has only one parent
directory. So, there is a total separation between the users which provide complete naming freedom.
Here, if a user wishes to access another users file, it has to go through two or more directories.

The tree directory structure provides an asymmetric way for the user to access the shared files of a
different user. For example, a user can access a file of its own user directory with a shorter path than
the other user.
9. Explain the necessary conditions that may lead to a deadlock situation.

1. Mutual exclusion
The resources involved must be unshakeable; otherwise, the processes would not be prevented from
using the resource when necessary.
2. Hold and wait or partial allocation
The processes must hold the resources they have already been allocated while waiting for other
(requested) resources. If the process had to release its resources when a new resource or resources
were requested, deadlock could not occur because the process would not prevent others from using
resources that it controlled.
3. No pre-emption
The processes must not have resources taken away while that resource is being used. Otherwise,
deadlock could not occur since the operating system could simply take enough resources from
running processes to enable any process to finish.
4. Resource waiting or circular wait
A circular chain of processes, with each process holding resources which are currently being
requested by the next process in the chain, cannot exist. If it does, the cycle theorem (which states
that "a cycle in the resource graph is necessary for deadlock to occur") indicated that deadlock could
occur.

10. What are the various methods for handling deadlocks?


 Deadlock Prevention.

Disallow one of the four necessary conditions for deadlock.


 Deadlock Avoidance.

Do not grant a resource request if this allocation have the potential to lead to a deadlock.
 Deadlock Detection.

Always grant resource request when possible. Periodically check for deadlocks. If a deadlock
exists, recover from it.
 Ignore the problem

Makes sense if the likelihood is very low.


End of Assignment 1

Assignment Rubrics:
Rubrics/Marking Scheme (Written Assignment)

Category 5 4 2 1
Organization Information is very Information is Information is The
Overall organized in a well- organized in a organized, but information
constructed well- paragraph(s) are not appears to be
paragraph or constructed well-constructed. disorganized.
paragraphs. paragraph or
paragraphs.
Amount of All topics are All topics are All topics are One or more
Information addressed and all addressed and addressed, and most topics
questions most questions answered were not
answered questions with 1 sentence addressed.
with at least 2 answered about each.
sentences about with at least 2
each. sentences
about
each.

Quality of Information clearly Information Information partially Information


Information relates to the topic. relates to the relates to the topic. has little or
It topic. It No details and/or nothing to do
includes details provides examples are given. with the topic.
and/or examples. few supporting
details and/or
examples.

Application of Information Information Information Information


Learning presented shows a presented presented shows a presented
clear understanding shows partial understanding shows
and application of understanding and application of little or no
the Professional and the Professional understanding
Development Topic. application of Development Topic. and
the application of
Professional the
Development Professional
Topic. Development
Topic.
Formatting Strictly followed Followed the Somewhat followed Not followed
(Followed the the instructions on formatting the formatting the formatting
formatting formatting instructions instructions. Need instructions.
instructions more concentration
given in the
assignment)
Organization All paragraphs have Most Some paragraphs Para. lack clear
Paragraph clear ideas, are paragraphs have clear ideas, ideas
supported with have support from
examples and have clear ideas, are examples may be
smooth transitions supported with missing and
some transitions are weak
examples and
have
transitions.
Critical Excellent: Analysis Good: Analysis Satisfactory: Analysis Insufficient:
Analysis of topic is of topic was of topic was Analysis of
thorough, writing thorough, superficial, writing topic was
reflects deep writing reflects reflects low level of superficial or
thought and critical general engagement, some misguided,
assessment and assessment, points of topic were writing does
solid arguments, only some not not reflect
and information points of addressed/information deep thought,
presented is discussion was inaccurate. critical points
accurate. topic were of the
addressed, discussion
information is were missing,
mostly and
accurate. information is
inaccurate.
Mechanics No grammatical, Almost no A few grammatical Many
spelling or grammatical, spelling, or grammatical,
punctuation errors. spelling punctuation errors. spelling, or
or punctuation punctuation
errors errors

Supporting Excellent: The Good: The Satisfactory: The Insufficient: No


Research research provided research research provided is citations,
is supportive of provided is supportive of your writing is
your argument, is mostly argument, but is not speculative,
from a credible appropriately appropriately cited, research is
source, is cited and from and writing is misguided
appropriately cited. credible speculative
sources, but
writing is
mostly
speculative.
Assignment Excellent: Intro, Good: Intro, Satisfactory: Intro, Insufficient:
Components body, body, body and conclusion Intro,
and conclusion and conclusion paragraphs are body, and
paragraphs are paragraphs are present but not well conclusion
clear clear, organized paragraphs are
and well organized, but not well missing/not
topic is introduced, used clear
discussed/analyzed,
and summarized.

Total Marks allotted : ______________/50_____________

You might also like