Vous êtes sur la page 1sur 6

OPERATING SYSTEM

ASSIGHNMENT 1










Name : Fakruddin ali ahmed khan
Batch : 7.45 to 9.45
Email : fpattan@rivier.edu
1.19
An interrupt can be known as hardware-generated change of ow with in the application or a
particular process with in the system. In such cases interrupt handler will be introduced to deal with
the reason due to which an interrupt is occurred; then control will be returned to the interrupted
context and instruction. A trap is a software-generated interrupt which can also be known as
software- oriented interrupt. An interrupt is mostly used to indicate the completion of an I/O in
order to obviate the need for device polling. In order to call operating system routines or to catch
arithmetic errors a Trap can be used.
Traps can also be generated intentionally through a user program by exceptions (e.g.,
floating point error, illegal instruction, or invalid memory reference) or through explicit instructions
in the program for the purpose of debugging. The reason for this is to allow a user to force a mode
switch to kernel mode
1.23
Consider a processor known as processor 1 which reads the data A with value 3 starting from main
memory to its local cache. Now let us consider another processor known as processor2 which reads
data A into its local cache as similarly as processor1. Then processor 1 will update A to 7. However,
as A resides in processor 1s local cache, the updating will only be occurring there unlike in the local
cache for processor 2.
2.11
Let us assume a system which would like to process both Windows XP and three other different
distributions of Linux (e.g., RedHat, Debian, and Mandrake). Every operating system which will be
running within the system will be stored on disk. During system boot-up, a special program (which
we often call as the boot manager) will give a overview regarding which operating system to boot
into. Which means that instead of initially booting to an operating system, the boot manager will be
first running during system start-up. It is this boot manager which is responsible for determining
which system to boot into. Typically boot managers must be stored at certain locations of the hard
disk which are often recognized during system start-up. Boot managers often provide the user with a
selection of systems to boot into; boot managers are also typically designed to boot into a default
operating system if no choice is selected by the user.
Boot strap program is basically a start- up program which is responsible for pointing out the
lower hard disk address where the operating system is stored. Typically it will be stored in the
computer hardware in ready only memory. It initializes all aspects of the operating system, from CPU
registers to device controllers to memory contents. The boot strap program must know how to start
execution of the program.

2.13
a. Pass parameters in registers
b. Registers pass starting addresses of blocks of parameters
c. Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by
the operating system

2.18
The two models of interprocess communication are message passing model and the shared-
memory model.
Strength Weakness
Message-Passing 1. No conflicts and
problem need to be
avoided.
2. Implementation
can be
implemented in a
easier way
The smaller amount of
data is exchanged only
when it is useful.
Shared-Memory When it takes place
within a computer, this
allows the
communication be
done at memory
speeds.
1. Implementation is
more difficult
compared to
message passing.
2. Problems exist in
the area of
protection and as
well as in
synchronization
between the
processes sharing
the memory.

2.19
Mechanism and policy ought to be separate to ensure that systems are easy to perform changes
such as modifying. No two system installations can be same, so each installation may want to
operate the operating system to suit its needs. With mechanism and policy separate, the policy may
be changed at will while the mechanism stays same being unchanged. With this arrangement a
exible system can be attained.


2.22
The loadable kernel modules can be known as the current best methodology for the
operating system design. There are additional services through modules; either must be at
boot time or must be during run time at the kernel. The design for the kernel is to provide
core services while other services dynamically running the kernel.
The various advantages of loadable kernel modules are
1. All the possibilities would have to be included by an operating system, anticipated
functionally already compiled straight into the base kernel, which has to be done in
the exception of loadable kernel module only.
2. The other is related to memory, the functionality resides in memory which is not
being utilised, memory wastage, and would require that users have to rebuild and as
well as to reboot the base kernel each and every time when they require new
operation.
3. Almost every operating system supports loadable kernel modules which will include
modules to support most desired operations.

3.2
There are 8 processes created
3.4
The SunUltraSPARC processor has multiple register sets. Describe what happens when a context
switch occurs if the new context is already loaded into one of the register sets. What happens if the
new context is in memory rather than in a register set and all the register sets are in use?
Answer: The CPU current-register-set pointer is changed to point to the set containing the new
context, which takes very little time. If the context is in memory, one of the contexts in a register set
must be chosen and be moved to memory, and the new context must be loaded from memory into
the set. This process takes a little more time than on systems with one set off registers, depending
on how are placement victim is selected.
3.13
Pid is initialized with a function fork(), If fork function returns the value which is less than
0(pid<0) then it si an error and fork will be failed. But instead, if it returns the value greater
than 0(pid>0) then the parent process will wait for the child to complete and display the
output that CHILD COMPLETE, Rather than these two if fork returns the value equal to
0(pid==0) then the function execlp will duplicate the actions in shell and then it will display
the output as LINE J. Hence these are all the circumstances by which LINE J will be
printed.

3.14
The values of Pid at lines A, B, C and D are

A=0, B=2603, C=2603, D=2600

3.17
If fork calls the child process(Pid==0) then the LINE X is executed then

CHILD: 0
CHILD: 1
CHILD: 2
CHILD: 3
CHILD: 4
Or if fork calls the parent process (Pid>0) then the LINE Y is executed then output
will be

PARENT: 0
PARENT: 1
PARENT: 2
PARENT: 3
PARENT: 4










































REFERENCES:

1. The Book of Operating system concepts 9
th
Edition.
2. http://en.wikipedia.org/wiki/Operating_system
3. http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes
.html