[SPRING 2015] ASSIGNMENT
PROGRAM
|
BSc IT
|
SEMESTER
|
SECOND
|
SUBJECT CODE & NAME
|
BT0070, Operating System
|
Q. NO. 1.
Write short notes on:
A. Process Creation
B. Terminating Process
Ans. A. Process
Creation: During the course of execution, a process may create
several new processes using a create-process system call. The creating process
is called a parent process and the new processes are called the children of
that process. Each of these new processes may in turn create other processes,
forming a tree of processes.
A process in general need certain resources (CPU time,
memory, I/O devices) to accomplish a task. When a process creates a sub
process, the sub process may be able to obtain its resources directly from the
operating system, or it may be constrained to a subset of the resources of the
parent process. The parent may have to partition its resources among its
children, or it may be able to share some resources (such as memory or files)
among several of its children.
In addition to the various physical and logical resources
that a poses obtains when it is created, initialized data may be passed along
by the parent process to the child process.
An example for this implementation is the DEC VMS operating system,
it creates a new process, loads a specified program into that process, and
starts running it. Both these approaches may also be supported by some
operating system. Microsoft Windows/NT is one such example. It supports both
the models. Either the parent address space may the operating system into the
address space of the new process may be specified.
B. Terminating Process: A process is
said to be terminated if it has finished execution of its last statement and
has called the exit system call to the operating system to delete itself. On
termination, the process should return to the parent process through the wait
system call. The operating system de-allocates the resources of the process
namely physical and virtual memory, I/O buffers and open files.
Only a parent process can
cause termination of its children via abort system call. For that a parent
needs to know the identities of its children. When one process creates a new
process, the identity of the created process is passed to the parent.
To illustrate process and
termination, let us consider UNIX system. In UNIX system a process may
terminate by using the exit system call and its parent process may wait for
that event by using the wait system call. It return the identifiers of the
child process which is terminated so that the parent process, the OS terminates
all the child processes of the particular process. UNIX has no way to report
the activities of a child process if its parent process has terminated.
Q. NO. 2. Write short notes on:
A. Critical
section problem
B. Buffering
Ans. A.
Critical section
problem: Critical
section is that part of the code section of a process which accesses would
result in data inconsistency. For example, consider a system with n processor
p1, p2, p3, p4………pn. It is important to ensure that when one process executes
in its critical section, other processes should not be allowed to execute in
their critical sections. Executions of processes in critical sections should be
mutually exclusive. The critical section problem is thus concerned about
establishing a protocol the processes in the system should follow to cooperate
with each other. When a process requires entry to critical section, it should
request permission to do so.
The following
requirements should be met by any solution to the critical section problem.
1.
Mutual Exclusion: if one process is in
its critical sections, no other process can executes in its critical section.
2.
Progress: The decision of which will
process should enter the critical section should not be indefinitely postponed.
When no process is in the critical section, the processes which are not in
their remainder section can participate in deciding which process will enter
the critical section next.
3.
Bounded Waiting: After a process
request to enter its critical section and before that request is granted, there
exist a bound on the number of times other processes may be allowed to enter
their critical sections.
In the following sections, a solution to critical section
problem is presented that meets these condition. Only the variables concerned
with synchronization here.
(B) Buffering: The number that can
be held by the buffer is determined by its capacity. This acts like a queue
connected to the link with messages in it. This facility can be implemented in
three way.
·
Zero capacity: This queue cannot hold any
message since its size is 0. Thus no message can be waiting in this link and
requirement forces the sender to wait till the recipient receives the message.
This calls for synchronization between the processes in sending and receiving
messages.
·
Bounded capacity: This queue with its
capacity bounded by a finite size of n can hold only n messages. While the
queue has an empty slot, sender may continue to execute after sending one
message. However if the queue is full since it has only n slots and if it is
full, the sender will have to wait to send another message, until the queue as
an empty slot.
·
Unbounded capacity: The queue has infinite
length and thus it can have any number of messages on it. The sender can
continue to send without waiting for the recipient.
The zero-capacity case is
sometimes referred to as a message system with no buffering; the other cases
provide automatic buffering.
Q. NO. 3.
What are TLBs? Why they are required in paging?
Ans.
A translation lookaside buffer (TLB) is a cache that memory management hardware
uses to improve virtual address translation speed. The majority of desktop,
laptop and server processor includes one or more TLBs in the memory management
hardware, and it is nearly always present in any hardware that utilizes paged
or segmented virtual memory.
They are required in paging because when access a CPU
generated address, one memory access is required to index into the page table.
This access using the value in PTBR fetches the frame number when combined with
the page-offset produces the actual address. Using this actual address, the
next memory access fetches the contents of the desired memory location.
To overcome this problem, a hardware cache called
translation look-aside buffers (TLBs) are used. TLBs are associative registers
that allows for a parallel search of a key item. Initially the TLBs contains
only a few or no entries. When a logical generated by the CPU is to be mapped
to a physical address, the page number is presented as input to the TLBs. If
the page number is found in the TLBs, the corresponding frame number is
available so that a memory access can be made. If the page number is not found
then a memory reference to the page table in main memory is made to fetch the
corresponding frame number. This page number next time will find an entry in
the table. Thus, a hit will reduce one memory access and speed up address
translation.
Q. NO. 4.
Describe the techniques of free space management of free space list.
Ans. The disk is a scarce resource. Also
disk space can be reused. Free space present on the disk is maintained by the
os. Physical blocks that are free are listed in a free-space list. When a file
is created or a file grows, requested for blocks of disk space are checked in
the free-space list and then allocated. The list is updated accordingly.
Similarly, freed blocks are added to the free-space list. The techniques of free space
management of free space list are following:
1.
Bit Vector: A bit map or a bit vector is a very common
way of implementing a free space list. This vector ‘n’ number of bits where ‘n’
is the total number or available disk blocks. A free blocks has its
corresponding bit set (1) in the bit vector whereas an allocated blocks has its
bit reset (0).
Illustration: if blocks
2,4,5,9,10,12,15,18,20,22,23,24,25,29 are free and the rest are allocated, than
a free-space list implemented as a bit vector would look as shown below:
00101100011010010101111000100000…….
The advantage of this approach is that it
is very simple to implement and efficient to access.
2.
Linked List: All free blocks are
linked together. The free-space list head contains the address of the first
free blocks. This blocks in turn contains the address of the next free block
and so on. But this scheme works well for linked allocation. If contiguous is
used then to search for ‘b’ contiguous free blocks calls for traversal of the
free-space list which is not efficient.
3.
Grouping: Another approach is to
store ‘n’ free block addresses in the first free block. Here (n-1) block are
actually free. The last nth address is the address of a block that advantage
that a large number of free blocks addresses are available at a single place
unlike in the previous liked approach where free block addresses are scattered.
4.
Counting: If contiguous allocation is
used and a file has freed its disk space then a contiguous set of ‘n’ blocks is
free. Instead of storing the addresses of all these ‘n’ blocks in the
free-space list, only the starting free blocks address and a count of the
number of blocks free from that address can be stored. This is exactly what is
done in this schemes where each entry in the free- space list is a disk address
followed by a count
Q. NO. 5.
What are computer viruses? How do they affect our system?
Ans.
A computer virus is a malware
program that, when executed, replicates by inserting copies of itself into
other computer programs, data files, or the boot sector of the hard drive; when
this replication succeeds, the affected areas are the then said to be
“infected”. A computer virus is written with an intention of infecting other
programs. It is a part of a program that piggybacks on to a program. It differs
from the worm in the following ways:
·
Worms is a complete program by itself and can execute independently
whereas virus does not operate independently.
Worm consumes only system resources but virus causes direct harm to
the system by corrupting code as well as data.
Different computer viruses creates different problems in different
ways. The most common problems are:
·
A virus may destroy all data stored in the hard disk by either
formatting it without warning or by destroying some of its sectors.
·
A virus may change the boot sector of the hard disk. If the boot
sector of a disk is affected, it cannot boot the computer.
·
The computer virus are automatically loaded into the main memory.
This slows down the data accessing speed of the computer.
Q.NO.6.
List and explain the types of multiprocessor OS.
Ans. There
are the three types of the multiprocessor operating system are:
·
Separate supervisors
·
Master/ slave
·
symmetric
Separate supervisors: In separates systems, each nodes is
a processor having a separate operating system with a memory and I/O resources.
Addition of a few additional services and data structure will help to support
aspects of multiprocessors.
A common example is the hypercube. Due to their repeating structure
constructed of identical holding blocks, they tends to replicates identical
copies of a kernel in each node.
Master/Slave: In this approach, one processor-
the master is dedicated to execute the operating system. The remaining
processors are slaves and form a pool of computational processors. The master
schedules and controls the slaves. This arrangements allows parallelism in an
application by allocating to it many slaves.
Master/slaves system are easy to develop. A uniprocessor os can be
adapted for master/slave multiprocessor operation with the addition of slave
scheduling. Such system have limited scalability. Major disadvantages are that
computational power of a whole processor is dedicated for control activity only
& if the master fails, the entire system is down.
Symmetric: All processors are functionally
identical. They form a pool of resources. Other resources such as memory and
I/O devices are available to all processor. If they are available to only a few
the system becomes asymmetric.
The os is also is symmetric. Any processor can execute it. In
response to workload requirements and processor availability, different
processors executes the os temporarily is the master.
An existing uniprocessor os such as UNIX can easily be ported to a
shared memory UMA multiprocessor. Shared memory contains the resident os code
and data structure.
No comments:
Post a Comment