Operating System
Download
Report
Transcript Operating System
IT2204:
Systems Administration I
8.
The Operating
System and
Booting
Software
2
• Application software: Programs for performing a specific task
– Word processing, spreadsheets, gaming, web page design, graphic
design
• System software:
– Operating software: Software that controls the overall
operation of the computer
– Utility software: Software that extends or customizes the
capabilities of the operating system
• Formatting
• compress/decompress data
3
• network communications
Operating System Software
• Operating System (OS) – Software that controls the overall
operation of a computer
4
What is an operating system (OS)?
Operating System Software
Software which manages the overall operation of the computer system including:
• hardware (CPU, RAM, I/O)
• security
• system interface
• application interface
5
What is an operating system (OS)?
6
The User’s View
7
8
What “is” an operating system?
Software files (programs) which are stored on
the hard disk
• kernel with the internal programs
• external programs
Supporting Data Files
9
The kernel
• The operating system software file (program) which is
copied into RAM, usually from the hard disk drive, during
the boot-up.
• The kernel remains in RAM while the computer is on and is
in charge of the overall operation of the computer
system.
• The kernel contains the “internal programs” for the
most often used operations like copying files.
– kmem (Linux)
– command.exe (Microsoft)
10
Kernel
• Kernel – The internal part of the operating
system.
– Those software components that perform the
basic functions required by the computer.
• File management
• Memory management (RAM)
• Security
11
12
The functions of an operating
system
1. Manages and Interacts with Computer
Hardware
2. Provides and Manages System Security
3. Provides the System Interface
4. Provides the Interface for Application Software
13
1. Manages and Interacts with
Computer Hardware
• Manages the CPU
- What software programs the
CPU works on and when
• Manages RAM
- What is stored in RAM and
where it is stored
- Virtual memory
- OS will send message when
RAM is full
14
1. Manages and Interacts with
Computer Hardware (continued)
• Provides the interface for
storage devices and manages
how data is stored on those
devices
- in charge of formatting disks
- creates sectors and clusters
- sends message when disk is
full or there is some other
problem with writing data to
the disk
- virtual memory
- CD-ROM, DVD-ROM
- Flash drive
15
1. Manages and Interacts with Computer
Hardware (continued)
•
Provides the Interface for Input and
Output Devices
– keyboard, mouse, printer,
– device drivers = software programs
which allow the hardware device to
be used by the operating system and
by application software
16
Processes
• Scheduler – Maintains a record of
the processes.
– Adds new processes when
launched.
– Removes old processes when
completed.
– Uses a process table.
• Process Table – Information
about each process including:
– Main memory cells (RAM)
– Priority
– Running or waiting (input from
user or saving to disk)
17
• Viewing processes with Microsoft Windows
• Task Bar – Right-click, Task Manager
18
• Ending a process – Killing the process
Processes
• Dispatcher - Oversees
the execution of each
process by the CPU.
– Gives each process a time
slice of CPU time.
– Changes between
processes.
19
Server (Multiuser) Operating Systems
• Found on mainframes, minicomputers and PCs
• server = a computer which processes information (CPU and
RAM) , stores information (hard disk), and/or provides access
to peripheral devices (printers) for multiple users
– Email
– Web
– Gaming
20
Examples of Server Operating
Systems
• MAC OS X Server
• Windows Server
21
Advantages/Disadvantages of Server
Operating Systems
Advantages
• Central location for the
installation and administration
of all software and data
• More cost effective - less
expensive than multiple
computers (PCs, Macs)
Disadvantages
• Single source for possible
problems
• Loss of individual user control
of their own software, data,
22
and peripherals
Virtual Memory
• Virtual Memory (VM) = the ability of the CPU
and the operating system software to use the hard
disk drive as additional RAM when needed (safety
net)
• Good – no longer get “insufficient memory” error
• Bad - performance is very slow when accessing VM
• Solution = more RAM
23
Virtual Memory
24
Virtual Memory
25
2. Provides and Manages System
Security
Single-user Operating
Systems
• minimal security
• user has full authority
Server Operating Systems
• login and password capability
• protection of user’s data
stored on the server’s central
hard disk drives
• protection and security for
software programs
26
3. Provides the System Interface
System Interface or shell
= the interface between
the user and the
computer
Command Line Interface
(CLI)
• Linux, UNIX, DOS, older
OS’s
Graphical User Interface
27
(GUI)
Command Line Interface
DOS, UNIX, others
28
DOS plus Windows 3.1
29
Windows 95
30
Windows XP
31
Macintosh
32
Mac OS X
33
UNIX with X-Windows
34
Microsoft Windows 8
35
4. Provides the Interface for
Application Software
• Operating systems are software
• Operating systems are designed
and developed for a specific CPU
or “family of CPUs”
– Macintosh OS: Motorola 680xx,
PowerPC Gx, Intel
– DOS: Intel CPUs
– Windows 9x and XP: Intel 80386,
80486, and Pentium CPUs
– Linux: Intel CPUs
– MS NT & 2000: Intel CPUs
36
4. Provides the Interface for Application
Software (continued)
• Application software is developed
for an operating system
MS Word for Windows XP
• Windows XP
• Intel CPU
MS Word for the Macintosh
• Macintosh OS X
• Gx CPU or Intel CPU
37
Compatibility
Question
• Will software developed for one operating
system work on another? Will MS Word for
Macintosh run on a PC with Windows XP?
Answer
• No (unless there is special emulation software or
hardware). The software must be developed
separately for each operating system.
• Much of this is beginning to change with MAC
using the Intel CPU. 38
Order of Development
1. The CPU
2. Other Hardware
Components
3. Operating System
Software
4. Application
Software
39
History of Operating Systems
1940’s – 1950’s
• Each program (job) required significant
preparation of equipment.
– Mounting tapes
– Loading punch cards
• Computer Operator – Person who
operated the computer.
– Mount tapes
– Load punch cards
– Take printouts off of printer
• Batch processing – The execution of
jobs by collecting them in a single batch,
the executing them without further
interaction with the user.
40
History of Operating Systems
• Job queue – Jobs residing in
mass storage (hard disk drives,
tape) waiting for execution.
– FIFO (First-In, First-Out)
– Job Priorities and scheduling
• Job Control Language (JCL)
– Set of instructions explaining
the steps of a particular job.
– Operating system sent these
to the printer
– Computer Operator follows
41
the instructions
History of Operating Systems
• Disadvantage to Batch
Processing – No interaction
with the user.
• Fine for software that does not
need user interaction:
– Payroll systems (creating
checks)
– Reporting systems
• Does not work well for other
types of software:
– Word processing
– Reservation systems
42
– Gaming
History of Operating Systems
• Newer Operating Systems
• Used remote terminals and
interactive processing
– Computer must be fast enough to
coordinate with the needs of the user.
• Real-time processing - Computer
must execute tasks under a deadline.
• Time sharing – Provides service to
multiple users at the same time.
– Multiprogramming - Time divided
into intervals.
• Multitasking – One user executing
numerous tasks (programs)
43
simultaneously
Today’s Operating Systems
Today’s CPUs (multiprocessors)
– Multiple processors
– Load balancing
• Dynamically allocating tasks to
the various processors so that all
processors are used efficiently.
– Scaling
• Breaking tasks into a number of
subtasks equal to the number of
processors available.
– The Network (Internet)
• Becoming a single network-wide
operating system rather than a
network of individual operating
systems.
44
•http://www.youtube.com/watch?v=ae_DKNwK_ms
•http://www.youtube.com/watch?v=UorIwPZU_eg
45
Booting
Bootstraping
i.e. starting a computer
System is particularly vulnerable at this
stage
– System initialization is a major security
problem in today’s Operating systems.
It is also easy for a user to change Bios
settings or drop at the shell and issue
commands that may be hazardous to a
machine.
47
Bootstraping
Steps in boot process
–
–
–
–
–
–
Loading and initialization of kernel
Device detection and configuration
Creation of spontaneous system processes
Operator intervention (manual boot only)
Execution of system startup scripts
Multiuser operation
48
Bootstraping
Kernel initialization
–
–
Kernel loaded into memory and executed
2-stage loading process
• small boot program read into memory to
enable kernel loading (outside domain of
Unix)
• kernel runs tests to determine memory
availability
□ kernels run in a fixed amount of memory
and know what to reserve for internal 49
storage and I/O buffers.
Bootstraping
Device detection and configuration
– Kernel performs HW check, initializing each
device it finds.
– Devices connected after boot time may not
be accessible to Unix processes until a reboot
is done.
– Drivers used to get more device info
• If not found, will disable hardware
• If hardware is added, must reboot, to be 50
accessible
Bootstraping
“Spontaneous” system process creation (done in user
space- portion of RAM where your processes run)
Spontaneous because it is not created using normal Unix
fork mechanism. fork creates copy of the original process,
with new ID, that is identical to the parent
– BSD has 3 processes
• Swapper - process 0;
• init - process1;
• pagedaemon - process 2
–
ATT: varies
sched - process 0;
init - process 1;
various memory handlers
• Kernel role in bootstrap ends after spontaneous process
creation.
• Basic operations e.g. login and linux daemons are taken51
care of by init
Bootstraping
Operator intervention (manual boot only)
– init notified via command-line flag from kernel
– init creates shell and waits for it to terminate (<ControlD> or exit) before continuing on with rest of startup
procedure
• Always in bourne shell (e.g., sh) and runs as root with
root partition mounted
• Available programs located in /bin, /sbin, /etc, and
maybe /usr;
• Daemons normally not available in single-user mode
• fsck ( file system consistency check is a system utility
that checks consistency of and repairs file systems) must
be run by hand.
Bootstraping
Execution of system startup script
– The location, content, and organization of
shell (e.g., sh) scripts vary from system to
system
– BSD: kept in /etc and names begin with rc
– ATT: kept in /etc/init.d with links made to
other directories such as /etc/rc0.d,
/etc/rc1.d…
53
Bootstraping
Execution of system startup script
– Examples of tasks performed in initialization
scripts
• Set computer name
• Set time zone
• Perform fsck disk check
• Mount system’s disks
• Remove files from /tmp
• Configure network interfaces
• Start up daemons and network services
• Turn on accounting and quotas
54
Bootstrap failure
When system boot fails:
–
–
–
–
–
HW problems
Defective/ faulty boot blocks
Damaged file systems
Improperly configured kernel
Startup script errors
55
Bootstraping
Multiuser Operation
– To complete boot process and allow user
access, init produces getty process on each
workstation. The getty (get teletype) process
manages terminals (physical or virtual), runs
the login program to authenticate the user.
– BSD: init has only two states: single-user and
multi-user
– ATT: init has one single-user and several
multi-user “run levels” to determine which
system resources are enabled
56
Bootstrap failure
HW problems
–
–
–
–
–
Are all devices powered?
Are all cables firmly connected?
Check faulty lights
Turn off everything for approximately 10sec
Perform stand-alone diagnostics
–
–
If firmware is bad, no boot.
Try booting from distribution media.
Defective boot blocks
57
Bootstrap failure
Damaged filesystems
–
–
Soft – scrambled info
Hard – head crash
–
Make arrangements for booting an old kernel in
case of problems.
Improperly configured kernel
Startup script errors
–
–
Sometimes only the editor ed is available, unless you
mount /usr
Hopefully, something on the screen will help you 58
know what is causing the problem and you fix it
Multiple Booting on PCs
Many OSs (Operating Systems) run on PCs hence
the possibility of booting several different OSs on a
PC.
–
A boot loader is needed to recognize the
different OSs.
Each disk partition can have its own boot loader,
however there is only one Master Boot Record
59
Boot Loaders
Linux boot loaders
-GRUB – GRand Unified Bootloader
-LILO – LInux Loader
GRUB is superior to LILO in a multibooting situation
□ supports larger file systems.
□ has a fully interactive CLI.
□ supports more file systems including DOS FAT (File Allocation
Table), BSD FFS (File System Snapshot) and Linux file systems.
□ If the configuration file is not configured properly, GRUB will
revert to a CLI rather than rendering system unbootable.
□ supports booting from network
Windows boot loader
60
– NTLDR (Win NT loader)
Boot Loaders
GRUB multiboot configuration
– Example grub.conf file
–
–
–
–
–
default=0
timeout=10
splashimage=(hd1,2)/grub/splash.xpm.gz
password --md5 $1$opeVt0$Y.br.18LyAasRsGdSKLYlp1
title Red Hat Linux
• password --md5 $1$0peVt0$Y.br.18LyAasRsGdSKLYlp1
• root (hd1,2)
• kernel /vmlinuz-2.4.18-14 ro root=LABEL=/
• initrd /initrd-2.4.18-14.img
– title Windows XP
• password --md5 $1$0peVt0$Y.br.18LyAasRsGdSKLYlp1
• rootnoverify (hd0,0)
61
• chainloader +1
Boot Loaders
grub.conf parameters
– default: signals to GRUB which image to boot from by default after the
timeout period. If not specified, grub boots the first image specified in the
file.
– timeout: number of seconds the boot prompt waits before
automatically loading the default OS
– splashimage: location of image to be used as the background for the
GRUB GUI.
– password: specifies MD5-encrypted password used to gain access to
GRUB's interactive boot options.
– title: identifies the specific OS that will be booted from at the user
interface at runtime. Unlike with LILO, you can include spaces in this
name.
– password: set in the same way as the password above. Do not set this
password to the root password if you are planning on sharing this 62
machine with other users.
Boot Loaders
grub.conf parameters
– root: tells GRUB where the OS file system actually lives. NB:
GRUB references the media in a different way from LILO. Grub
references this disk as (hd1,2), again the third partition of the
second disk (disk 0 being the first disk, partition 0 being the first
partition).
– kernel: vmlinuz-X.X.XX-XX is the name of the default boot kernel
image within your root directory.
– initrd: initrd-X.X.XX-XX.img is the name of the default initrd file
within your root directory.
– rootnoverify option tells GRUB to not try to vary the root of the
OS. This saves load errors if the file system is not a supported by
GRUB.
– chainloader +1 tells GRUB to use a chain loader to load this OS,63
which is required for loading Windows
Boot Loaders
LILO multiboot configuration
–
–
–
–
–
–
–
–
–
–
Example lilo.conf file
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=100
compact
default=Linux
image=/boot/vmlinuz-2.4.18-14
• label=Linux
• root=/dev/hdb3
• read-only
• password=linux
other=/dev/hda
• label=WindowsXP
64
Boot Loaders
lilo.conf parameters
– boot: tells LILO where to install the boot loader.
– map: points to the map file used by LILO internally during bootup.
– install: is one of the files used internally by LILO during the boot
process. This holds both the primary and secondary parts of the boot
loader. A segment of this boot.b file is written to the MBR (the
primary part of the boot loader), which then points to the map and
subsequently points to the secondary boot loader.
– prompt: tells LILO to use the user interface (two selections -- Linux
and WindowsXP for this example). If not specified, LILO boots into
the default OS with no user interaction and no waiting.
– timeout: is the number of tenths of a second that the boot prompt
will wait before automatically loading the default OS, in this case
Linux. If prompt is not specified, this parameter is ignored.
65
Boot Loaders
lilo.conf parameters
– compact: option magically makes the boot process quicker by
merging adjacent disk read requests into a single request.
– default: tells LILO which image to boot from by default, such as after
the timeout period. This relates to a label of one of the images in the
lilo.conf file. If not specified LILO will boot the first image in the file.
– image: specifies Linux version available to boot into.
– label: identifies the different OS to boot from at the user interface at
runtime. In addition, this label is used for specifying the default OS to
boot from.
– root: tells LILO where the OS file system actually lives. In our
example, it is /dev/hdb3, which is the third partition of the second
disk.
– read-only: tells LILO to perform the initial boot to the file system
read only. Once the OS is fully booted, it is mounted read-write. 66
Boot Loaders
lilo.conf parameters
– password: option allows a password to be set for the
specific OS one is booting into. In the example this
password is held in the lilo.conf file as readable text,
so is easily accessible for all to read.
– other: acts like a combination of the image and root
options, but for OSs other than Linux. In this example,
it tells LILO where to find the Windows OS, which
resides on the first disk in the first partition. This will
usually be the case if Windows was installed first,
then Linux.
– label: is the same as all other label options.
67
Booting into single user mode
This is a good way to change system
configuration or perform maintenance tasks
without affecting or being troubled by other
users (only the administrator uses the
machine and a few system tasks)
It comes in handy when working on a broken
system
68
Startup scripts
Runlevels in Red Hat, Suse and all other members
of Red Hat family:
– 0 - Halt, init 0 is similar to shutdown -h now
– 1 - Single user, runs just /etc/rc.d/rc.sysinit. Does
not run /etc/rc.d/rc
– 2 - Multiuser, with networking (sshd, syslogd,
Sendmail, no firewall), but without NFS (Network
File System) (The same as 3, if you don't have
networking)
69
Startup scripts
Runlevels in Red Hat, Suse and all other members of Red
Hat family:
– 3 - Full multi-user (firewall, rpc (remote procedure
call), nfs, ntpd (network time protocol daemon)).
Console logins only (no X11).
– 4 - Not used/undefined
– 5 - Full multi-user, with additional network services (
httpd(http daemon), vsftpd (very secure ftp deamon)),
X11 and display manager as well as console logins
– 6 - Reboot
70
Startup Scripts
At each runlevel, init invokes /etc/rc.d/rc with the new
runlevel as an argument.e.g.
–
/etc/rc.d/rc 5 , init runs the /etc/rc.d/rc script (or command)
with the parameter of 5 whenever runlevel 5 is entered. init
then waits until this command completes before doing
anything else.
Scripts used by init when starting the system, changing
runlevels, or shutting down are typically stored in the
/etc/init.d or /etc/rc.d directory.
A series of symbolic links in the rcn.d directories, one
directory for each runlevel n, control whether a script is
started when entering a runlevel or stopped when leaving it.
Rebooting and Shutting Down
Reboot if necessary
Reboot to make new configuration work
Ways of rebooting
–
–
–
–
–
–
Turn of power (not good!)
Shutdown
Halt & reboot
Send init a TERM signal
Using telinit to change init's run level
Use poweroff command to tell system to turn
72
off power
** Read Chapter 14 (The boot process)
from the Ubuntu Unleashed book
Q&A