In: Computer Science
The title of the course is OS. All answers should be based on that. Please do not copy and paste answers on chegg or on google for me. All answers should be based on your understanding on the course. Please try as much to answer the questions based on what is asked and not setting your own questions and answering them. Let it be if you want copy and paste answers.
**********************************************************************************************************************************************************************************************************************
(1)
Operating systems protect the computer hardware and its
components. They also perform many responsibilities
and/or provide services to manage various resources of
the computer system as well as promote the efficiency of
use of the computer systems.
(i). In your own words, distinguish between user-visible
registers and control and status registers
in the context of computer systems and
embedded systems used in organizations; and
draw a table of comparison to illustrate your
answer.
(ii). Identify two examples of each the above
categories of registers and explain, in your own
words, the functions that each of them performs
in a computer system.
(iii). Discuss how an operating system protects
computer hardware, processor, main memory,
and input-output devices of a computer system;
and provide appropriate practical examples to
illustrate your answer.
(iv). Explain practical issues that an operating
system may encounter in its attempt to
accomplish the protections you discussed in
(iii) above.
(v). In your own words, explain the services that an
operating system provides for either process
management or file management in computer
systems and/or embedded systems used in
hospitals.
Thanks
(i)
User-Visible Registers
A user-visible register is one that may be referenced by means of the machine language that the processor executes and that is generally available to all programs, including application programs as well as system programs. The following types of registers are typically available: data, address, and condition codes.
General Purpose Register
The general-purpose registers detain both the addresses or the
data. Although we have separate data registers and address
registers. The general purpose register also accepts the
intermediate results in the course of program execution.
Well, the programmers can restrict some of the general-purpose registers to specific functions. Like, some registers are specifically used for stack operations or for floating-point operations. The general-purpose register can also be employed for the addressing functions.
Data registers
Data registers can be assigned to a variety of functions by the
programmer. In some cases, they are
general purpose in nature and can be used with any machine
instruction that performs operations on data.
Often, however, there are restrictions. For example, there may be
dedicated registers for floating-point
operations.
Address registers
Address registers contain main memory addresses of data and
instructions, or they contain a portion
of the address that is used in the calculation of the complete
address. These registers may themselves be
somewhat general purpose, or they may be devoted to a particular
addressing mode. Examples include:
• Index register:
Indexed addressing is a common mode of addressing that involves
adding
an index to a base value to get the effective address.
• Segment pointer:
With segmented addressing, memory is divided into
variable-length
blocks of words called segments. A memory reference consists of a
reference to a particular
segment and an offset within the segment; this mode of addressing
is important in memory
management. In this mode of addressing, a register is used to hold
the address of the base
(starting location) of the segment. There may be multiple
registers; for example, one for the
operating system (i.e., when operating-system code is executing on
the processor) and one
for the currently executing application.
• Stack pointer:
If there is user-visible stack addressing, then typically the
stack is in main
memory and there is a dedicated register that points to the top of
the stack. This allows the
use of instructions that contain no address field, such as push and
pop.
Conditional Code
A final category of registers, which is at least partially visible
to the user, holds condition codes (also
referred to as flags). Condition codes are bits set by the
processor hardware as the result of operations. For
example, an arithmetic operation may produce a positive, negative,
zero, or overflow result. In addition to
the result itself being stored in a register or memory, a condition
code is also set. The code may subsequently be tested as part of a
conditional branch operation.
Condition code bits are collected into one or more registers.
Usually, they for m part of a control register. Generally, machine
instructions allow these bits to be read by implicit reference, but
they cannot be
altered by the programmer.
Control and Status Registers
There are a variety of processor registers that are employed to
control the operation of the processor. Most of these, on most
machines, are not visible to the user. Some of them may be
accessible by machine instructions executed in a control or
operating-system mode. Of course, different machines will have
different register organizations and use different terminology. We
will list common register types, with a brief description.
In addition to the MAR, MBR, IOAR, and IOBR registers mentioned
earlier, the following are essential to instruction execution:
• Program counter (PC): Contains the address of an
instruction to be fetched.
• Instruction register (IR): Contains the
instruction most recently fetched.
• Memory Address Register (MAR): Memory address register holds the address of a memory location.
• Memory Buffer Register (MBR): The memory buffer register holds the data that has to be written to a memory location or it holds the data that is recently been read.
The memory address registers (MAR) and memory buffer registers (MBR) are used to move the data between processor and memory.
All processor designs also include a register or set of
registers, often known as the program status
word (PSW), which contains status information. The PSW
typically contains condition codes plus other
status information. Common fields and flags include the
following:
• Sign: Contains the sign bit of the last
arithmetic operation.
• Zero: Set when the result of an arithmetic
operation is zero.
• Carry: Set if an operation resulted in a carry
(addition) into or borrow (subtraction) out of a
high-order bit. Used for multi-word arithmetic operations.
• Equal: Set if a logical compare result is
equality.
• Overflow: Used to indicate arithmetic
overflow.
• Interrupt Enable/Disable: Used to disable or
enable interrupts. When interrupts are disabled, the processor
ignores them. This is often desirable when the operating system is
in
the midst of dealing with another interrupt.
• Supervisor: Indicates whether the processor is
executing in supervisor or user mode. Certain privileged
instructions can be executed only in supervisor mode, and certain
areas of
memory can be accessed only in supervisor mode.
(ii)
(iii)
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources.
For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or is interrupted by it. Operating systems are found on many devices that contain a computer – from cellular phones and video game consoles to web servers and supercomputers.
The dominant desktop operating system is Microsoft Windows with a market share of around 82.74%. macOS by Apple Inc. is in second place (13.23%), and the varieties of Linux are collectively in third place (1.57%). In the mobile (including smartphones and tablets) sector, Google Android's share is up to 70% in the year 2017. According to third quarter 2016 data, Android's share on smartphones is dominant with 87.5 percent with also a growth rate of 10.3 percent per year, followed by Apple's iOS with 12.1 percent with per year decrease in market share of 5.2 percent, while other operating systems amount to just 0.3 percent. Linux distributions are dominant in the server and supercomputing sectors. Other specialized classes of operating systems, such as embedded and real-time systems, exist for many applications.
(iv)
A threat is a program that is malicious in nature and leads to harmful effects for the system. Some of the common threats that occur in a system are −
Virus
Viruses are generally small snippets of code embedded in a system.
They are very dangerous and can corrupt files, destroy data, crash
systems etc. They can also spread further by replicating themselves
as required.
Trojan Horse
A trojan horse can secretly access the login details of a system.
Then a malicious user can use these to enter the system as a
harmless being and wreak havoc.
Trap Door
A trap door is a security breach that may be present in a system
without the knowledge of the users. It can be exploited to harm the
data or files in a system by malicious people.
Worm
A worm can destroy a system by using its resources to extreme
levels. It can generate multiple copies which claim all the
resources and don't allow any other processes to access them. A
worm can shut down a whole network in this way.
Denial of Service
These type of attacks do not allow the legitimate users to access a
system. It overwhelms the system with requests so it is overwhelmed
and cannot work properly for other user.
(v)
Deadlock Recovery
hospital intensive care monitoring, etc.) where something
disastrous can happen if the deadlock is not detected and corrected
quickly. Thus another reason to check for deadlock is that a
process has been blocked on a resource request “too long.” The
definition of “too long” can vary widely from process to process.
It depends both on how
long the process can reasonably expect to wait for the request, and
how urgent the response is. If an overnight run deadlocks at 11pm
and nobody is going to look at its output until 9am the next day,
it doesn't matter whether the deadlock is detected at 11:01pm or
8:59am. If all the processes in a system are sufficiently similar,
it may be adequate simply to check for deadlock at periodic
intervals (e.g., one every 5 minutes in a batch system; once every
millisecond in a realtime control system).