You are on page 1of 17

CSE 2320 – Systems

Programming
Chapter 2: operating Systems function
Operating system
• An Operating System (OS) is an interface between a computer user and
computer hardware and controls the execution of all kinds of programs..
• operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling
input and output, and controlling peripheral devices such as disk drives
and printers.
• Some popular Operating Systems include Linux Operating System,
Windows Operating System, VMS, OS/400, AIX, z/OS, etc.
Cont…
Operating systems function
Memory Management
• Memory management refers to management of Primary Memory or Main
Memory. 
Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in
use.
In multiprogramming, the OS decides which process will get memory when and how much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.

• Processor Management
• In multiprogramming environment, the OS decides which process gets the
processor when and for how much time. This function is called process scheduling.
• Time-sharing operating systems schedule tasks for efficient use of the system
Cont…
• Device Management
• An Operating System manages device communication via their respective drivers.
Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.
• File Management
• A file system is normally organized into directories for easy navigation and usage.
Keeps track of information, location, uses, status etc. The collective facilities are often known
as file system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Unix and Linux
 Unix was originally developed in 1969 by a group of AT&T employees Ken Thompson,
Dennis Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs.
 There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix
and BSD are a few examples. Linux is also a flavor of Unix which is freely available.
 Several people can use a Unix computer at the same time; hence Unix is called a
multiuser system.
 A user can also run multiple programs at the same time; hence Unix is a multitasking
environment.
• The Unix operating system is a set of programs that act as a link between the computer
and the user.
Cont …
• Unix was originally written in assembly language.[13] Ken Thompson wrote B, mainly based on 
BCPL, based on his experience in the MULTICS project.
• B was replaced by C, and Unix, rewritten in C, developed into a large, complex family of inter-
related operating systems which have been influential in every modern operating system (see 
History).
• The Unix-like family is a diverse group of operating systems, with several major sub-categories
including System V, BSD, and Linux.
Linux
• Linux is Unix-like, but was developed without any Unix code, unlike BSD and its variants.
• Because of its open license model, the Linux kernel code is available for study and modification,
which resulted in its use on a wide range of computing machinery from supercomputers to
smart-watches.
• Although estimates suggest that Linux is used on only 1.82% of all "desktop" (or laptop) PCs, it
has been widely adopted for use in servers and embedded systems such as cell phones.
Cont …
• Linux has superseded Unix on many platforms and is used on most
supercomputers including the top 385.
• Many of the same computers are also on Green500 (but in different order),
and Linux runs on the top 10.
• Linux is also commonly used on other small energy-efficient computers, such
as smartphones and smartwatches.
• The Linux kernel is used in some popular distributions, such as Red Hat, Debian
, Ubuntu, Linux Mint and Google's Android, Chrome OS, and Chromium OS.
• The main concept that unites all the versions of Unix/Linux is the following
basics:-
Kernel
• The kernel is the heart of the operating system. It interacts with
the hardware and most of the tasks like memory management,
task scheduling and file management.
• With the aid of the firmware and device drivers, the kernel
provides the most basic level of control over all of the
computer's hardware devices.
• It manages memory access for programs in the RAM, it
determines which programs get access to which hardware
resources, it sets up or resets the CPU's operating states
for optimal operation at all times, and it organizes the
data for long-term non-volatile storage with file systems
 on such media as disks, tapes, flash memory, etc.
• A kernel connects the application software to the
hardware of a computer.
Modes

• Modern microprocessors (CPU or MPU) support multiple modes of operation.


• CPUs with this capability offer at least two modes: user mode and 
supervisor mode.
• In general terms, supervisor mode operation allows unrestricted access to all
machine resources, including all MPU instructions.
• User mode operation sets limits on instruction use and typically disallows direct
access to machine resources.
• CPUs might have other modes similar to user mode as well, such as the virtual
modes in order to emulate older processor types, such as 16-bit processors on a
32-bit one, or 32-bit processors on a 64-bit one.
Cont …
• At power-on or reset, the system begins in supervisor mode.
• Once an operating system kernel has been loaded and started, the boundary between
user mode and supervisor mode (also known as kernel mode) can be established.
• Supervisor mode is used by the kernel for low level tasks that need unrestricted access to
hardware, such as controlling how memory is accessed, and communicating with devices
such as disk drives and video display devices.
• User mode, in contrast, is used for almost everything else.
• Application programs, such as word processors and database managers, operate within
user mode, and can only access machine resources by turning control over to the kernel,
a process which causes a switch to supervisor mode.
• Typically, the transfer of control to the kernel is achieved by executing a 
software interrupt instruction, such as the Motorola 68000 TRAP instruction.
• The software interrupt causes the microprocessor to switch from user mode to
supervisor mode and begin executing code that allows the kernel to take control.
Cont …
• In user mode, programs usually have access to a restricted set of microprocessor
instructions, and generally cannot execute any instructions that could potentially
cause disruption to the system's operation.
• In supervisor mode, instruction execution restrictions are typically removed,
allowing the kernel unrestricted access to all machine resources.
• The term "user mode resource" generally refers to one or more CPU registers,
which contain information that the running program isn't allowed to alter.
• Attempts to alter these resources generally causes a switch to supervisor mode,
where the operating system can deal with the illegal operation the program was
attempting, for example, by forcibly terminating ("killing") the program).
• Privilege rings for the x86 microprocessor architecture available in protected mode.
• Operating systems determine which processes run in each mode.
Cont. …
• "Virtual memory" provides the
programmer or the user with the
perception that there is a much
larger amount of RAM in the
computer than is really there.
• Many operating systems can "trick"
programs into using memory
scattered around the hard disk and
RAM as if it is one continuous chunk
of memory, called virtual memory.
Disk access and file systems
• File systems allow users and
programs to organize and sort files
on a computer, often through the use
of directories (or "folders").
User interface
• Every computer that is to be operated by an individual requires a 
user interface.
• The user interface is usually referred to as a shell and is essential if human
interaction is to be supported.
• The user interface views the directory structure and requests services from
the operating system that will acquire data from input hardware devices,
such as a keyboard, mouse or credit card reader, and requests operating
system services to display prompts, status messages and such on 
output hardware devices, such as a video monitor or printer.
• The two most common forms of a user interface have historically been the 
command-line interface, where computer commands are typed out line-by-
line, and the graphical user interface, where a visual environment (most
commonly a WIMP) is present.
Shell
• The shell is the utility that processes your requests.
• When you type in a command at your terminal, the shell interprets the
command and calls the program that you want.
• The shell uses standard syntax for all commands. C Shell, Bourne
Shell and Korn Shell are the most famous shells which are available
with most of the Unix variants.
Commands and Utilities
• There are various commands and utilities which you can make use of
in your day to day activities. cp, mv, cat and grep, etc. are few
examples of commands and utilities.
• There are over 250 standard commands plus numerous others
provided through 3rd party software.
• All the commands come along with various options.
Files and Directories
• All the data of Unix is organized into files.
• All files are then organized into directories.
• These directories are further organized into a tree-like structure called
the file system.

You might also like