Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Name: Thái Đình Chinh

Student ID: DE170147


Class: SE17C01
Subject: OSG202
Ex: Review 2

1. Explain terms: Multiprogramming, Register (Program counter, stack pointer,


Program status word).

- Multiprogramming is a rudimentary form of parallel processing in which several


programs run at the same time on a uniprocessor system. However, because there
is only one processor, there is no true simultaneous execution of different programs.
- A program counter (PC) is a CPU register in the computer processor with the
address of the next instruction to be executed from memory. It is a digital counter
needed for faster execution of tasks as well as for tracking the current execution
point. A program counter is also known as an instruction counter, instruction pointer,
instruction address register or sequence control register.
- A stack pointer is a small register that stores the memory address of the last data
element added to the stack or, in some cases, the first available address in the
stack.
- The program status word (PSW) is a register that performs the function of a status
register, program counter, and sometimes more. The term is also applied to a copy
of the PSW in storage.

2. One reason GUIs were initially slow to be adopted was the cost of the
hardware needed to support them. How much video RAM is needed to support
a 25 line x 80 row character monochrome text screen? How much for a 1024 x
768 pixel 24-bit color bitmap?

- RAM needed for text screen : (25 line) x (80 character) = 2000 bytes
- RAM needed for color bitmap: 1024x768x24=18874368 bits=2359296 bytes

3. What is the difference between kernel and user mode? Explain how having
two distinct modes aids in designing an operating system.

- The CPU can execute every instruction in its instruction set and use every feature
of the hardware when executing in kernel mode. However, it can execute only a
subset of instructions and only uses a subset of features when executing in user
mode. From there we have two modes that allow designers to run user programs in
user mode and thus deny them access to important instructions.

Criteria Kernel Mode User Mode


In kernel mode, the
In user mode, the
Kernel-mode vs program has direct and
application program
User mode unrestricted access to
executes and starts.
system resources.

In Kernel mode, the whole In user mode, a single


Interruptions operating system might go process fails if an interrupt
down if an interrupt occurs occurs.

Kernel mode is also known User mode is also known


as the master mode, as the unprivileged mode,
Modes
privileged mode, or system restricted mode, or slave
mode. mode.

In kernel mode, all In user mode, all processes


Virtual address
processes share a single get separate virtual address
space
virtual address space. spaces.

In kernel mode, the


While in user mode the
applications have more
Level of privilege applications have fewer
privileges as compared to
privileges.
user mode.

As kernel mode can access


While user mode needs to
both the user programs as
access kernel programs as
Restrictions well as the kernel
it cannot directly access
programs there are no
them.
restrictions.

The mode bit of kernel- While; the mode bit of user-


Mode bit value
mode is 0. mode is 1.
It can only make references
It is capable of referencing
Memory References to memory allocated for
both memory areas.
user mode.

A system crash in kernel In user mode, a system


mode is severe and makes crash can be recovered by
System Crash
things more complicated. simply resuming the
session.

Only essential functionality User programs can access


Access is permitted to operate in and execute in this mode
this mode. for a given system.

The user mode is a


standard and typical
The kernel mode can refer
viewing mode, which
to any memory block in the
implies that information
system and can also direct
cannot be executed on its
Functionality the CPU for the execution
own or reference any
of an instruction, making it
memory block; it needs an
a very potent and
Application Protocol
significant mode.
Interface (API) to achieve
these things.

4. A 255-GB disk has 65,536 cylinders with 255 sectors per track and 512 bytes
per sector. How many platters and heads does this disk have? Assuming an
average cylinder seek time of 11 ms, average rotational delay of 7 msec and
reading rate of 100 MB/sec, calculate the average time it will take to read 400
KB from one sector.

- As a single surface of a single platter have the capacity: 65536*255*512( B)


- As a 255-GB disk would have 255x230 (B)
- The number of surfaces: 255*230 / (65536*255*512 ) = 32 ( surfaces)
- Any surface has to have at least 1 head, so for this problem, there are 32 heads.
- As we know, any platter has 2 surfaces, so there are 32/2 = 16 platters.
- The average time to read 400KB from one sector:
11*10-3 + 7*10-3 + (400*210)/(100*220) = 0.011+0.007+0.004=0.022s=22 ms

You might also like