Comp Sys Archi

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

1.

3 Computer-System Architecture

A computer system may be organized in a number of different ways, which we can categorize roughly
according to the number of general-purpose processors used.

· 1.3.1Single-ProcessorSystems

Most systems vise a single processor. a single-processor system, there is one main CPU capable of
executing a general-purpose instruction set, including instructions from user processes. Almost all
systems have other special-purpose processors as well. They may come in the form of device-
specific processors, such as disk, keyboard, and graphics controllers; or, on mainframes, they may
come in the form of more general-purpose processors, such as I/O processors that move data
rapidly among the components of the system.
All of these special-purpose processors run a limited instruction set and do not run user processes.
Sometimes they are managed by the operating system, in that the operating system sends them
information about their next task and monitors their status.

· 1.3.2MultiprocessorSystems

Multiprocessor systems (also known as parallel systems or tightly coupled systems) are growing
in importance. Such systems have two or more processors in close communication, sharing the
computer bus and sometimes the clock, memory, and peripheral devices.

Multiprocessor systems have three main advantages:

1. Increased throughput. By increasing the number of processors, we expect to get more work done
in less time. The speed-up ratio with N processors is not N, however; rather, it is less than N. When
multiple processors cooperate on a task, a certain amount of overhead is incurred in keeping all the
parts working correctly. This overhead, plus contention for shared
resources, lowers the expected gain from additional processors. Similarly, N programmers working
closely together do not produce N times the amount of work a single programmer would produce.

2. Economy of scale. Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage, and power supplies. If several
programs operate on the same set of data, it is cheaper to store those data on one disk and to
have all the processors share them than to have many computers with local
disks and many copies of the data.

3. Increased reliability. If functions can be distributed properly among several processors, then the
failure of one processor will not halt the system, only slow it down. If we have ten processors and one
fails, then each of the remaining nine processors can pick up a share of the work of the failed
processor. Thus, the entire system runs only 10 percent slower, rather than failing altogether.

Graceful degradation is the ability to continue providing service proportional to the level of surviving
hardware.
Fault tolerant some systems go beyond graceful degradation.
The multiple-processor systems in use today are of two types.

· Asymmetric multiprocessing, which each processor is assigned a specific task. BOSS


WORKER RELATIONSHIP.
· Symmetric multiprocessing (SMP), The most common systems use in which each processor
performs all tasks within the operating system.

· 1.3.3 Clustered Systems

Clustered system is an another type of multiple-CPU system. Clustered systems differ from
multiprocessor systems, however, in that they are composed of two or more individual systems
coupled together..

Clustering is usually used to provide high-availability service; that is, service will continue even if one
or more systems in the cluster fail. Clustering can be structured asymmetrically or symmetrically.
Cluster technology is changing rapidly. Some cluster products support dozens of systems in a cluster,
as well as clustered nodes that are separated by miles. Many of these improvements are made
possible by storage-area networks (SANs), which allow many systems to attach to a pool of
storage.

· 1.4 Operating-System Structure

An operating system provides the environment within which programs are executed. One of the most
important aspects of operating systems is the ability to multiprogram. A single user cannot, in general,
keep either the CPU or the I/O devices busy at all times.
Multiprogramming increases CPU utilization by organizing jobs (code and data) so that the CPU
always has one to execute. The operating system keeps several jobs in memory simultaneously
(Figure 1.7).
Time sharing (or multitasking) is a logical extension of multiprogramming. In time-sharing systems,
the CPU executes multiple jobs by switching among them, but the switches occur so frequently that
the users can interact with each program while it is running.
Time sharing requires an interactive (or hands-on) computer system, which provides direct
communication between the user and the system.
A time-shared operating system allows many users to share the computer simultaneously. A time-
shared operating system uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time-shared computer.

1.5 Operating-System Operations

An operating system is a construct that allows the user application programs to


interact with the system hardware. Operating system by itself does not provide any
function but it provides an atmosphere in which different applications and programs
can do useful work.
The major operations of the operating system are process management, memory
management, device management and file management. These are given in detail
as follows:

Process Management
The operating system is responsible for managing the processes i.e assigning the processor to a
process at a time. This is known as process scheduling. The different algorithms used for process
scheduling are FCFS (first come first served), SJF (shortest job first), priority scheduling, round robin
scheduling etc.
There are many scheduling queues that are used to handle processes in process management.
When the processes enter the system, they are put into the job queue. The processes that are ready
to execute in the main memory are kept in the ready queue. The processes that are waiting for the
I/O device are kept in the device queue.

Memory Management
Memory management plays an important part in operating system. It deals with memory and the
moving of processes from disk to primary memory for execution and back again.
The activities performed by the operating system for memory management are −
 The operating system assigns memory to the processes as required. This can be
done using best fit, first fit and worst fit algorithms.
 All the memory is tracked by the operating system i.e. it nodes what memory parts are
in use by the processes and which are empty.
 The operating system deallocated memory from processes as required. This may
happen when a process has been terminated or if it no longer needs the memory.

Device Management
There are many I/O devices handled by the operating system such as mouse, keyboard, disk drive
etc. There are different device drivers that can be connected to the operating system to handle a
specific device. The device controller is an interface between the device and the device driver. The
user applications can access all the I/O devices using the device drivers, which are device specific
codes.
File Management
Files are used to provide a uniform view of data storage by the operating system. All the files are
mapped onto physical devices that are usually non volatile so data is safe in the case of system
failure.
The files can be accessed by the system in two ways i.e. sequential access and direct access −
 Sequential Access
The information in a file is processed in order using sequential access. The files
records are accessed on after another. Most of the file systems such as editors,
compilers etc. use sequential access.
 Direct Access
In direct access or relative access, the files can be accessed in random for read and
write operations. The direct access model is based on the disk model of a file, since it
allows random accesses.

Operating system services:

The operating system provides the programming environment in which a programmer works on a
computer system. The user program requests various resources through the operating system. The
operating system gives several services to utility programmers and users. Applications access these
services through application programming interfaces or system calls. By invoking those interfaces, the
application can request a service from the operating system, pass parameters, and acquire the
operation outcomes.

Following are the services provided by an operating system -


o Program execution
o Control Input/output devices
o Program creation
o Error Detection and Response
o Accounting
o Security and Protection
o File Management
o Communication

Program execution To execute a program, several tasks need to be performed. Both the instructions
and data must be loaded into the main memory. In addition, input-output devices and files should be
initialized, and other resources must be prepared. The Operating structures handle these kinds of
tasks. The user now no longer should fear the reminiscence allocation or multitasking or anything.

Control Input/output devices As there are numerous types of I/O devices within the computer
system, and each I/O device calls for its own precise set of instructions for the operation. The
Operating System hides that info with the aid of presenting a uniform interface. Thus, it is convenient
for programmers to access such devices easily.

Program Creation

The Operating system offers the structures and tools, including editors and debuggers, to help the
programmer create, modify, and debugging programs.

Error Detection and Response

An Error in a device may also cause malfunctioning of the entire device. These include hardware and
software errors such as device failure, memory error, division by zero, attempts to access forbidden
memory locations, etc. To avoid error, the operating system monitors the system for detecting errors
and takes suitable action with at least impact on running applications.

While working with computers, errors may occur quite often. Errors may occur in the:
o Input/ Output devices: For example, connection failure in the network, lack of paper in the
printer, etc.
o User program: For example: attempt to access illegal memory locations, divide by zero, use
too much CPU time, etc.
o Memory hardware: For example, Memory error, the memory becomes full, etc.

To handle these errors and other types of possible errors, the operating system takes appropriate
action and generates messages to ensure correct and consistent computing.

Accounting An Operating device collects utilization records for numerous assets and tracks the
overall performance parameters and responsive time to enhance overall performance. These personal
records are beneficial for additional upgrades and tuning the device to enhance overall performance.

Security and Protection Operating device affords safety to the statistics and packages of a person
and protects any interference from unauthorized users. The safety feature counters threats, which are
published via way of individuals out of doors the manage of the running device.

For Example: When a user downloads something from the internet, that program may contain
malicious code that may harm the already existing programs. The operating system ensures that
proper checks are applied while downloading such programs.If one computer system is shared
amongst a couple of users, then the various processes must be protected from another intrusion. For
this, the operating system provides various mechanisms that allow only those processes to use
resources that have gained proper authorization from the operating system. The mechanism may
include providing unique users ids and passwords to each user.
File management Computers keep data and information on secondary storage devices like magnetic
tape, magnetic disk, optical disk, etc. Each storage media has its capabilities like speed, capacity, data
transfer rate, and data access methods.

For file management, the operating system must know the types of different files and the
characteristics of different storage devices. It has to offer the proportion and safety mechanism of
documents additionally.

Communication The operating system manages the exchange of data and programs among different
computers connected over a network. This communication is accomplished using message passing
and shared memory.

Kernel in Operating System


Kernel is central component of an operating system that manages operations of computer and hardware. It
basically manages operations of memory and CPU time. It is core component of an operating system. Kernel
acts as a bridge between applications and data processing performed at hardware level using inter-process
communication and system calls.
Kernel loads first into memory when an operating system is loaded and remains into memory until operating
system is shut down again. It is responsible for various tasks such as disk management, task management, and
memory management
Introduction to System Calls
To understand system calls, first one needs to understand the difference between kernel
mode and user mode of a CPU. Every modern operating system supports these two modes.

Modes supported by the operating system

Kernel Mode

 When CPU is in kernel mode, the code being executed can access any memory address and
any hardware resource.
 Hence kernel mode is a very privileged and powerful mode.
 If a program crashes in kernel mode, the entire system will be halted.

User Mode

 When CPU is in user mode, the programs don't have direct access to memory and hardware
resources.
 In user mode, if any program crashes, only that particular program is halted.
 That means the system will be in a safe state even if a program in user mode crashes.
 Hence, most programs in an OS run in user mode.

System Call
When a program in user mode requires access to RAM or a hardware resource, it must ask the kernel
to provide access to that resource. This is done via something called a system call.
When a program makes a system call, the mode is switched from user mode to kernel mode. This is
called a context switch.
Then the kernel provides the resource which the program requested. After that, another context
switch happens which results in change of mode from kernel mode back to user mode.

A system call is a way for a user program to interface with the operating system. The program
requests several services, and the OS responds by invoking a series of system calls to satisfy the
request. A system call can be written in assembly language or a high-level language like C or Pascal.
System calls are predefined functions that the operating system may directly invoke if a high-level
language is used.

What is a System Call?


A system call is a method for a computer program to request a service from the kernel of
the operating system on which it is running. A system call is a method of interacting with the
operating system via programs. A system call is a request from computer software to an operating
system's kernel. The Application Program Interface (API) connects the operating system's functions
to user programs. It acts as a link between the operating system and a process, allowing user-level
programs to request operating system services. The kernel system can only be accessed using system
calls. System calls are required for any programs that use resources. Vry Catch
How are system calls made?
When a computer software needs to access the operating system's kernel, it makes a system call. The
system call uses an API to expose the operating system's services to user programs. It is the only
method to access the kernel system. All programs or processes that require resources for execution
must use system calls, as they serve as an interface between the operating system and user programs.

Below are some examples of how a system call varies from a user function.
1. A system call function may create and use kernel processes to execute the asynchronous
processing.
2. A system call has greater authority than a standard subroutine. A system call with kernel-
mode privilege executes in the kernel protection domain.
3. System calls are not permitted to use shared libraries or any symbols that are not present in
the kernel protection domain.
4. The code and data for system calls are stored in global kernel memory.

Why do you need system calls in Operating System?

There are various situations where you must require system calls in the operating system. Following of
the situations are as follows:
1. It is must require when a file system wants to create or delete a file.
2. Network connections require the system calls to sending and receiving data packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a system call.
5. System calls are used to create and manage new processes.

How System Calls Work

The Applications run in an area of memory known as user space. A system call connects to the
operating system's kernel, which executes in kernel space. When an application creates a system call, it
must first obtain permission from the kernel. It achieves this using an interrupt request, which pauses
the current process and transfers control to the kernel.

If the request is permitted, the kernel performs the requested action, like creating or deleting a file. As
input, the application receives the kernel's output. The application resumes the procedure after the
input is received. When the operation is finished, the kernel returns the results to the application and
then moves data from kernel space to user space in memory.

A simple system call may take few nanoseconds to provide the result, like retrieving the system date
and time. A more complicated system call, such as connecting to a network device, may take a few
seconds. Most operating systems launch a distinct kernel thread for each system call to avoid
bottlenecks. Modern operating systems are multi-threaded, which means they can handle various
system calls at the same time.

Types of System Calls

There are commonly five types of system calls. These are as follows:
Process Control Process control is the system call that is used to direct the processes. Some
process control examples include creating, load, abort, end, execute, process, terminate the process,
etc.
File Management File management is a system call that is used to handle the files. Some file
management examples include creating files, delete files, open, close, read, write, etc.
Device Management Device management is a system call that is used to deal with devices. Some
examples of device management include read, device, write, get device attributes, release device, etc.
Information Maintenance Information maintenance is a system call that is used to maintain
information. There are some examples of information maintenance, including getting system data, set
time or date, get time or date, set system data, etc.
Communication Communication is a system call that is used for communication. There are some
examples of communication, including create, delete communication connections, send, receive
messages, etc.

You might also like