You are on page 1of 72

OPERATING

SYSTEMS
INTRODUCTION TO OPERATING SYSTEMS
Hardware definition
• Physical part of the system, the “machine".
• Central Processing Unit (CPU)
• Arithmetic – Logic Unit (ALU)
• Arithmetic Unit.
• Logic Unit.
• Memory.
• Read Only Memory (ROM)
• Random Access Memory (RAM)
• Control Unit
• Input devices
• Output devices
• I / O devices

LUIS H. CRUZ A. 2
OPERATING SYSTEMS
Software definition
• "Intangible" part of the system.
• Set of instructions that controls the activity of
the computer.
• Various types:
• Applications, Programs, Systems.
• Utilities.
• Programming languages.
• Operating systems.

LUIS H. CRUZ A. 3
OPERATING SYSTEMS
Operating System definition
• It uses the hardware resources of one or
more processors and their peripherals.
• Offer a set of services to the users of the
system and the programmer.
• It also manages secondary memory and I/O
devices.
• It is a program that controls the execution of
application programs.

LUIS H. CRUZ A. 4
OPERATING SYSTEMS
Operating System definition
• It is an interface between application
programs and hardware.
• It hides the hardware details from the user.
• The Operating System differs from the
applications, an application can be
changed, an OS no.
• The code required for an OS average is 5
million lines of code.

LUIS H. CRUZ A. 5
OPERATING SYSTEMS
Operating System examples
• MS-DOS
• Windows 3.1, 95, 98, Me, 2000, XP, Vista, 7, 8, 10
• Windows NT, Windows Server
• Apple Macintosh MacOS
• Unix and other related
• System V, AIX, Solaris.
• Linux, BSD as an alternative to Unix
• Red Hat, Mandrake, Suse, Ubuntu, Debian, FreeBSD, etc.
• IBM Mainframe
• IBM i, z/OS, z/TPF, z/VM, z/VSE
• Many others.

LUIS H. CRUZ A. 6
OPERATING SYSTEMS
User Interface
• Control Language
• Indicates to OS a specific action or task to perform.
• Examples:
• Write a data set or file.
• Compile a program.
• Run a program.
• Open or close files.
• Others.
• An application called “Shell” is in charge of this.
• GUI (Graphical User Interface) uses graphics and
icons.

LUIS H. CRUZ A. 7
OPERATING SYSTEMS
Operating System Kernel
• Part of the Operating System resident in the main
memory.
• Contains the most frequently used functions.
• It is also called “core of the OS"
• Also called Micro-kernel and monolithic.
• The OS runs in kernel (supervisor) mode with full
access.
• In user mode, access is restricted to certain
machine instructions.

LUIS H. CRUZ A. 8
OPERATING SYSTEMS
Operating System location

Final User
Application Programs
User
Mode

Utilities
Programmer

Operating System

Operating Kernel
Computer Hardware Mode
System Designer

LUIS H. CRUZ A. 9
OPERATING SYSTEMS
Operating System services
• Execution of Programs.
• Access to I/O devices.
• Controlled file access.
• Access to the System and specific resources, provides
protection and resolves property conflicts of resources.

LUIS H. CRUZ A. 10
OPERATING SYSTEMS
Operating System services
• Detection and response to errors:
• Internal and external hardware errors.
• Memory errors.
• Device failures.

• Software errors.
• Arithmetic Overflow.
• Access prohibited to memory locations.

• The operating system should give a response


that removes the error condition with the least
possible impact on running applications.

LUIS H. CRUZ A. 11
OPERATING SYSTEMS
Operating System services
•Accounting:
• Collect statistics on the use of various resources.
• Monitor performance parameters.
• Checking response time.
• Used for future improvements.
• For billing users.

LUIS H. CRUZ A. 12
OPERATING SYSTEMS
OS as Extended Machine
•The function of the Operating
System is to present to the user the
equivalent of an extended machine
or virtual machine that is easier to
program than the implicit hardware.
•Hide details of operation to be
performed.
•The user interacts with the virtual
machine which is easier to use.

LUIS H. CRUZ A.
OPERATING SYSTEMS
13
OS as Resource Manager
• The main task of the operating system is to keep track of
who uses which resource, grant resource requests,
explain the use, and intercede in conflicting requests from
different programs and users.
• Directs the processor in the use of system resources.
• It directs the processor when other programs are running,
it has time control.
• The processor stops running the OS to run other
programs.

LUIS H. CRUZ A. 14
OPERATING SYSTEMS
OS as Resource Manager
• Each program gets time from a resource
• Each program gets space from the resource.
• The interface between the operating system and user
programs is defined by the set of "extended
instructions" that the operating system provides, these
are known as system calls.

LUIS H. CRUZ A.
OPERATING SYSTEMS
15
Definition of Operating System

• The Operating System can be considered as the most


fundamental of all programs.
• It controls all the resources of the computer system and
provides the foundation on which application programs
can be coded.
• The operating system is a layer of software that is on
top of the hardware.

LUIS H. CRUZ A.
OPERATING SYSTEMS
16
Definition of Operating System
• In this way, all parts of the system are managed and the
user is presented with an interface or virtual machine
that is easier to understand and program.

LUIS H. CRUZ A.
OPERATING SYSTEMS
17
Historical review

• First generation(1945 – 1955)


• Vacuum tubes (bulbs), punch cards.
• Atanasoff and Berry computer with 300 bulbs.
• Zuse's Z3 used relays in Germany.
• In England the Colossus was built.
• Mark I was raised at Harvard University.
• Eckert and Mauchly build the ENIAC.
• Cable connection boards were used.
• The programming was done by creating circuits with bulbs,
there were no operating systems.
• In 1950 the boards were replaced by punch cards.

LUIS H. CRUZ A.
OPERATING SYSTEMS
18
Historical review
• Second generation(1955 – 1965)
• Transistors and batching systems.
• The computers were "mainframes" locked in special
rooms with air conditioning.
• The "jobs" were written on punched cards.

LUIS H. CRUZ A.
OPERATING SYSTEMS
19
Historical review
• Second generation (1955 – 1965)
• Batch processing systems.
• Offline processing operations (without connection to the
computer).
• Assembler and Fortran Operating Systems such as FMS (Fortran
Monitor System) and IBSYS of the IBM 7094.

LUIS H. CRUZ A.
OPERATING SYSTEMS
20
Historical review
• Third generation (1965 – 1980)
• Integrated circuits and multiprogramming.
• The IBM 360 was the first computer to use integrated circuits
on a small scale.
• The OS / 360 Operating System worked on all IBM models
such as 370, 4300, 3080 and 3090.
• Multiprogramming prevented a process from having to wait for
a long I / O operation, memory was split and used for different
"jobs".

LUIS H. CRUZ A.
OPERATING SYSTEMS
21
Historical review
• Third generation (1965 – 1980)
• When a job was finished, a new one no longer had to be loaded
from the punch card reader, it was now done automatically from the
magnetic disk in the technique called Spooling (Simultaneous
Peripheral Operation On Line).
• Time sharing (time sharing) is a variant of multiprogramming that
allowed several users to work at the same time, the computer
attended them when the CPU was idle.
• The first time-sharing system was CTSS (Compatible Time Sharing
System) from M.I.T.

LUIS H. CRUZ A.
OPERATING SYSTEMS
22
Historical review
• Third generation (1965 – 1980)
• MULTICS (MULTiplexed Information and Computing Service) was
developed to serve hundreds of users in the Boston area.
• Ken Thompson of Bell Labs who worked at MULTICS developed a
version for a user on a smaller PDP-7 minicomputer and in the
computer PDP-11.
• UNIX has had two major versions: System V from AT&T, BSD from
UC Berkeley, POSIX an IEEE standard, and a small clone for
educational purposes called MINIX, which was the basis for creating
Linux by Linus Torvalds.

LUIS H. CRUZ A.
OPERATING SYSTEMS
23
Historical review
• Fourth generation (1980 – actual)
• Personal computers.
• Development of LSI (Large Scale Integration) in integrated circuits
that allowed the creation of microcomputers.
• The Intel 8088 was the microprocessor that was used for the first
microcomputer, an OS disk-based system called CP / M (Control
Program for Microcomputers) in the mid-70's.
• IBM designed the IBM PC (Personal Computer) and based on a
DOS (Disk Operating System) Bill Gates created MS-DOS
(Microsoft Disk Operating System) which also included the BASIC
programming language.

LUIS H. CRUZ A.
OPERATING SYSTEMS
24
Historical review
• Fourth generation (1980 – today)
• The IBM PC / AT with the Intel 80286 CPU used an improved
version of MS-DOS that included CP / M and XENIX functions.
• The Graphical User Interface (GUI) developed in the 1960s by
Xerox was considered by Steve Jobs for the Apple Lisa computer.
• Windows was the GUI version that worked on MS-DOS in Windows
95 and 98 for 16-bit Intel processor, later on the NT (New
Technology) version, Me (Millenium edition) with Pentium
processors was created, Windows 2000 was the basis for the XP
version, the most successful one.

LUIS H. CRUZ A.
OPERATING SYSTEMS
25
Historical review
• Fourth generation (1980 – today)
• UNIX also ran on Pentium processors with the FreeBSD version
(from the University of Berkeley).
• The X Window System version known as X11 is the first version of
UNIX with a GUI.
• In the mid-1980s, network operating systems were developed used
for the first connected computer networks and distributed operating
systems that work with more than one processor, thus requiring
processor scheduling algorithms.

LUIS H. CRUZ A.
OPERATING SYSTEMS
26
Computer hardware

LUIS H. CRUZ A.
OPERATING SYSTEMS
27
Computer hardware
Processors.
• Program Counter: Contains the memory address of the next
instruction to be obtained..
• Stack Pointer: Points to the top of the current memory stack
that contains a set of values ​for each procedure that entered
but did not exit.
• PSW (Program Status Word): Contains the condition code bits,
assigned when comparing, used to process system calls and
I/O operations.

LUIS H. CRUZ A.
OPERATING SYSTEMS
28
Computer hardware
• Pipeline: Processing of several instructions at once, each
one must be obtained, encoded and executed.
• Superescalar pipeline: Two or more instructions for integer
arithmetic, floating point, and logical operations are
fetched, decoded, and buffered before being executed.

LUIS H. CRUZ A.
OPERATING SYSTEMS
29
Computer hardware
• System Call: Command trapped in the kernel that invokes the
Operating System.
• Multithreading or Hyperthreading Chip : Pentium 4 or similar
processor that works with two threads of execution alternating
one and the other, it can be a running program together with a
lightweight process.
• Each thread appears to the Operating System as a separate
processor.
• 2 separate processors each with 2 threads appear as 4 threads to
the Operating System.

LUIS H. CRUZ A.
OPERATING SYSTEMS
30
Computer hardware
• Core or Multicore Chip: Processor with 2, 4 or more complete
processors included.
• A multiprocessor Operating System is required.
• 4-core chip (quad-core).

LUIS H. CRUZ A.
OPERATING SYSTEMS
31
Memory

• Data storage.
• Memory organized in 64-byte cache lines.
• Access to memory must be faster than the execution of an
instruction by the CPU.
• L1 Cache and L2 cache memory: Memory inside the high-speed
CPU is used to store decoded instructions to be executed.
• The L1 cache has no timeout, the L2 cache takes 1 or 2 clock cycles.
• Intel processors share L2 cache with the cores, in AMD each core
has L2 cache.

LUIS H. CRUZ A.
OPERATING SYSTEMS
32
Memory
• Random Access Memory (RAM): Memory for requests to the CPU
that do not go through the cache.
• Read Only Memory (ROM): Contains the boot loader (Bootstrap
loader).
• Electrically Erasable PROM (EEPROM) and Flash Memory: Non-
volatile memory that can be erased and overwritten.

LUIS H. CRUZ A.
OPERATING SYSTEMS
33
Disks
Hard Disk.
• Disks spinning at 5400, 7200, or 10800 rpm.
• The data is stored in tracks and cylinders.

LUIS H. CRUZ A.
OPERATING SYSTEMS
34
Disks
• Virtual Memory: Disk is used to store very
large programs that do not fit in main
memory, which in turn is used as a cache.
• Memory Management Unit (MMU): It is on
the CPU and controls access to disk data
and memory to convert physical addresses
in RAM.
• Tapes: To find data on a tape it must first be
"mounted" on a tape reader, by a person or
by a robot.

LUIS H. CRUZ A.
OPERATING SYSTEMS
35
I/O Devices
•Integrated Drive Electronics (IDE): Simple
interfaces to control disc readers.
• Driver or controller: Software that
communicates the device with the Operating
System, there is a different one for each OS.
•I/O port space: Collection of all records that
are used to communicate to the OS with
devices.
•Interruptions: Communications between the
device and the OS.

LUIS H. CRUZ A.
OPERATING SYSTEMS
36
I/O Devices
•Interrupt vector: Part of memory where the device status is saved.

•Direct Memory Access (DMA): Control the bit flow between


memory and device without CPU intervention.

LUIS H. CRUZ A.
OPERATING SYSTEMS
37
Buses
• Eight bus system (PCI, SCSI, USB, IDE and ISA) with different
transfer speeds and functions.

LUIS H. CRUZ A.
OPERATING SYSTEMS
38
Buses
• ISA (Industry Standard Architecture).
• PCI (Peripheral Component Interconnect).
• USB (Universal Serial Bus).
• SCSI (Small Computer System Interface).
• Fire Wire o IEEE 1394 of Apple.
• Connect and use concept (Plug and Play).

LUIS H. CRUZ A.
OPERATING SYSTEMS
39
Booting the computer
• BIOS (Basic Input Output System).
• Device diagnostics.
• CMOS Memory.
• Booting the Operating System:
• From Hard Disk.
• From CD-ROM.
• From Flash Memory (USB).
• Other.

LUIS H. CRUZ A.
OPERATING SYSTEMS
40
Operating Systems Zoo
• Mainframe OS.
• Computers with large amounts of I / O.
• Processing many jobs at once:
• Batch processing.
• Transaction processing.
• Shared time.
• Examples: OS / 390, OS / 360, Z/OS.

• Server OS.
• Servers or very large PCs, workstations.
• Web servers, print or file servers.
• Examples: Solaris, FreeBSD, Linux, Windows Server.

LUIS H. CRUZ A.
OPERATING SYSTEMS
41
Operating Systems Zoo
• Multiprocessor OS.
• Multiple processors on one CPU.
• Computers with multi-core chips.
• Examples: Windows and Linux.

• Personal Computer OS.


• They support multiprogramming.
• They serve a single user.
• Examples: Linux, FreeBSD, Windows, MacOS.

LUIS H. CRUZ A.
OPERATING SYSTEMS
42
Operating Systems Zoo
• Handheld Computer OS.
• PDA (Personal Digital Assistant) or Handheld.
• 32-bit CPUs that support telephony and multimedia.
• Examples: Symbian OS and Palm OS.

• Embedded OS.
• Embedded control non-computer devices such as microwave ovens,
TVs, cars, MP3 players, cell phones.
• Examples: QNX and VxWorks.

LUIS H. CRUZ A.
OPERATING SYSTEMS
43
Operating Systems Zoo
• Sensor-Node OS.
• Small computers that connect wirelessly to a base.
• Computers with built-in radios and batteries used for security.
• Example: TinyOS.

• Real Time OS.


• Industrial process control systems and data collection.
• Systems that perform a function in a certain time.
• Example: e-Cos.

LUIS H. CRUZ A.
OPERATING SYSTEMS
44
Operating Systems Zoo
• Smart Card OS.
• Very small devices that have a chip.
• Some work with Java and have a virtual machine (JVM) installed.
• Java applets are downloaded onto a card and are interpreted by the
JVM.
• Very primitive operating systems with few functions.

LUIS H. CRUZ A.
OPERATING SYSTEMS
45
Basic concepts of Operating
Systems
•Processes.
•Address spaces.
•Files.
•Input / Output.
•Protection.
•Shell.

LUIS H. CRUZ A.
OPERATING SYSTEMS
46
Processes
•What is a Process?
• A running program.
• An instance of a program running on a computer.
• Entity that can be assigned to, and executed on, a
processor.
• A unit of activity characterized by a single
sequential thread of execution, a current state, and
a set of associated system resources.

LUIS H. CRUZ A.
OPERATING SYSTEMS
47
Processes
•It consists of three components:
• An executable program
• Associated data, necessary for the program
• Context of program execution
• A process contains all the information that the OS requires to
manage it (program counter, instruction register, stack and
other information).

LUIS H. CRUZ A.
OPERATING SYSTEMS
48
Processes
• In many Operating Systems, all the information regarding
each process is stored in an Operating System table called
the process table, which is an array (or linked list) of
structures, one for each process in current existence.
• Thus a process consists of its address space, generally called
the kernel image, and its process table record.

LUIS H. CRUZ A.
OPERATING SYSTEMS
49
Processes
• A process can create one or more different processes
(known as child processes) and these in turn generate new
child processes, a tree structure is quickly reached.

B C

D E F

LUIS H. CRUZ A.
OPERATING SYSTEMS
50
Process state

Process state: Transitions between states:


1. The process is blocked by I / O.
Running: It is using the CPU,
2. The process is suspended due to time-out.
executing its instructions.
3. The scheduler selects a process from the
Blocked: Waiting for I / O completion. ready processes list.

Ready: Waiting to be selected to use 4. The process terminates its I / O and is


unlocked.
the CPU.

LUIS H. CRUZ A. 51
OPERATING SYSTEMS
Address Spaces
• The OS allows to put several programs in memory at the
same time.
• With 32 or 64 bit computers they can address 232 or 264
memory locations.
• Additionally, virtual memory can be used with a disk to get
more space.
• This allows for more storage in limited memory.

LUIS H. CRUZ A.
OPERATING SYSTEMS
52
Files
• A file is a block of
information that generally
is stored on disk.
• The directory is a way to
store files, it has a tree
structure.

LUIS H. CRUZ A.
OPERATING SYSTEMS
53
Files
• Another important concept in UNIX and Linux is the special
file.
• Special files are provided in order to make I/O devices look
like files.
• That way, they can be read and written using the same
system calls as are used for reading and writing files.
• Two kinds of special files exist: block special files and
character special files.

LUIS H. CRUZ A.
OPERATING SYSTEMS
54
Files
• Block special files are used to model devices that consist of a
collection of randomly addressable blocks, such as disks.
• By opening a block special file and reading, say, block 4, a
program can directly access the fourth block on the device,
without regard to the structure of the file system contained
on it.

LUIS H. CRUZ A.
OPERATING SYSTEMS
55
Input / Output
• There are many Input and Output devices, keyboards,
monitors, printers, etc.
• It is the responsibility of the OS manage those devices.
• The I / O subsystem manages and is independent of devices.
• Another piece of software are the "drivers".

LUIS H. CRUZ A.
OPERATING SYSTEMS
56
Protection
• UNIX and Linux OS handles 9 bits for files.
• The rwx bits (read write and execute) protect at the owner,
group and public level.
• Also for directories there is search permission.

LUIS H. CRUZ A.
OPERATING SYSTEMS
57
Protection
• CPU operating modes:
• User mode: Access to part of the resources is restricted.
• Supervisor mode: Access to all resources.
• Memory protection: Prevents a user's program from
accessing the programs and data of other users and
the operating system.

LUIS H. CRUZ A.
OPERATING SYSTEMS
58
Protection
• Timer - Prevents a job from monopolizing system resources.
• Privileged instructions - Executed only by the OS.
• Interrupts - They are calls to kernel functions.
• If a program tries to use restricted resources, an interrupt
occurs.

LUIS H. CRUZ A.
OPERATING SYSTEMS
59
Shell
• Shell is not part of the Operating System, but it makes
heavy use of system calls.
• When a user logs in, a Shell is started.
• Once activated, the Shell waits for the user to issue a
command.
• When a command is issued the Shell creates a derived
process and waits for it to finish.

LUIS H. CRUZ A.
OPERATING SYSTEMS
60
System Calls
• A system call is a
special type of
procedure call that
goes into the kernel.
• A call from a C
program:
count = read (fd, bufer,
nbytes)

LUIS H. CRUZ A.
OPERATING SYSTEMS
61
System Calls in POSIX

LUIS H. CRUZ A.
OPERATING SYSTEMS
62
System Calls in POSIX

LUIS H. CRUZ A.
OPERATING SYSTEMS
63
Calls in UNIX
• Processes have three segments: text, data, and stack. In this
example, all three are in the address space, but spaces for
separate data and instructions are also supported.

LUIS H. CRUZ A.
OPERATING SYSTEMS
64
System Calls for Directory
Management
• The following call:
link (“/usr/jim/memo” , “/usr/ast/note”)
• File memo is inserted to ast directory with the name of note.

LUIS H. CRUZ A.
OPERATING SYSTEMS
65
File system
• For the next call:
Mount (“dev/fd0” , “/mnt”, 0)
• File system before and after linking:

LUIS H. CRUZ A.
OPERATING SYSTEMS
66
Monolithic Systems
• OS runs as a single kernel-mode program.
• The basic structure is as follows:

LUIS H. CRUZ A.
OPERATING SYSTEMS
67
Layered Systems
• OS works in layers, each supporting the upper ones.

LUIS H. CRUZ A.
OPERATING SYSTEMS
68
MINIX 3 Microkernels
• The basic idea of ​microkernel is to achieve high reliability by
dividing the OS in small, well-defined modules.
• Only the microkernel runs in kernel mode and the rest of the
processes in user mode.

LUIS H. CRUZ A.
OPERATING SYSTEMS
69
Client – Server Model
• Servers provide services that clients use.
• Communication is through messages.
• The client sends requests and receives responses from the
server.

LUIS H. CRUZ A.
OPERATING SYSTEMS
70
Virtual Machine VM/370
• The CMS (Conversational Monitor System) was a single-user
virtual machine running on IBM 360 machines.
• The VM / 370 could also run OS / 360 for multiple users.
• In other virtual machines, different OS.

LUIS H. CRUZ A.
OPERATING SYSTEMS
71
The World according to C
• Operating systems are normally
large C (or sometimes C++)
programs consisting of many
pieces written by many
programmers.
• An Operating System project
generally consists of some number
of directories, each containing
many .c files containing the code
for some part of the system, along
with some .h header files that
contain declarations and
definitions used by one or more
code files.

LUIS H. CRUZ A. 72
OPERATING SYSTEMS

You might also like