Week_9

advertisement
1
Week Nine Announcements
Introduction:
Take attendance
See if there were issues completing the last lab assignment.
Week Nine Agenda:
This is standard agenda for week nine.
Link of the week
http://installation.openoffice.org/
The Installation project contains several different modules that are necessary
to create OpenOffice.org installation sets. This includes the description of
the installation sets as well as the packaging process in which the native
installation sets are created.
http://en.wikipedia.org/wiki/Installation
Define: Installation (or setup) of a program and drivers is the act of putting the program
in a computer system so that it can be executed.
Installation Process:
- Condensed form intended for sale or distribution
- Unpack so that the relevant information is placed correctly on the computer.
- Customized settings required by the user.
- Testing is required during the installation to insure compatibility
- Configure the computer to store the relevant files and settings for the program to
operate properly.
Most programs are supplied in a condensed form intended for sale and distribution. In
order to be used, they must be 'unpacked' and the relevant information placed correctly on
the computer, taking account of variations between computers, and any customized
settings required by the user. During installation, various tests are made of system
2
Week Nine Announcements
suitability, and the computer is configured to store the relevant files and any necessary
settings required for that program to operate correctly.
Because the requisite process varies for each program and each computer, many
programs (including operating systems) come with a general-purpose or dedicated
installer – a specialized program which automates most of the work required for their
installation.
Review week eight lab assignment
Start off by clarifying the role of ANSI.
Review the Installation Exercise lab assignment.
Review firmware and display the Firmware Concentric Circle Relationship.
Review the Red Hat Package Manager tool.
Software package file format:
A file format is a particular way to encode information for storage in a computer file.
Since a disk drive, or any other computer storage can only store bits, the computer must have
some way of converting information to 0s and 1s and vice-versa. There are different kinds of
formats for different kinds of information. Within any format type, e.g., word processes
documents, there will typically be several different formats. Sometimes these formats
compete with each other.
Some file formats are designed to store very particular sorts of data: the JPEG format, for
example, is designed only to store static photographic images. Other file formats, however,
are designed for storage of several different types of data: the GIF format supports storage of
both still images and simple animations, and the QuickTime format can act as a container for
many different types of multimedia. A test file is simply one that stores any text, in a format
such as ASCII orUTF-8, with few if any control characters. Some file formats, such as HTML, or
the source code of some particular programming language, are in fact also text files, but
adhere to more specific rules which allow them to be used for specific purposes.
A computer file is a block of arbitrary information, or resource for storing information,
which is available to a command is usually computer program based on some kind of
durable storage. A file is durable in the sense that it remains available for programs to
use after the current program has finished. Computer files can be considered as the
modern counterpart of paper documents which traditionally were kept in offices' and
libraries files, which are the source of the term.
Define: bzip2 / bunzip2
bzip2 filename.tar
bunzip2 –d filename.tar.bz2
3
Week Nine Announcements
What is single user mode?
This mode is referred to as the Maintenance Mode. It is a restricted mode that allows the
system administrator to repair a system during the boot phase.
What is virtual memory?
This is a process where disk space is used to swap process memory pages both in and out
of memory/
What is kernel space?
This is where the kernel resides in memory at all times. This space is reserved strictly
for executing the kernel, device drivers and any extensions the kernel might need.
Why isn’t the kernel swapped out of memory like other processes?
The kernel is intended to operate in a real time environment. If portions of the kernel
were swapped out, it would introduce system performance delays and stalled conditions.
What is user space?
User space is similar to kernel space. It is space reserved for user applications and off
limits for the kernels use. The user memory space is swappable. User multi-tasking
wouldn’t be possible without swapping.
Week nine expected outcome
We will define the first bullet item this week.
Next Lab Assignment
5.1 Startup
Starting a machine is typically called "booting" the machine. The boot process must
perform similar tasks, regardless of the operating system. A computer, when first
turned on, understands very little. It must be told what peripherals it has, such as a
keyboard, monitor, sound card, network, etc. The computer only knows enough
about disk drives to be able to load a very specific portion of the disk (typically called
the boot sector).
The code in the boot sector then tells the computer what to do next. This process is
called "bootstrapping," as the computer is told more and more about its resources.
The boot process continues long after the boot sector has been executed. Once the
operating system itself has been loaded, the operating system executes special
initialization scripts that continue the boot process.
The boot process is finished only when the operating system is able to allow a user
to log in and work.
4
Week Nine Announcements
Steps involved in booting system (start up process):
1. Find and load the kernel. His first step is hardware dependent. There is no
operating system active at this point.
2. Kernel invocation. This step can be implemented using third party software.
3. init invocation. This step can also be implemented with third party software.
Initially, the CPU is pre-set to the RESET mode prior to booting. The CPU is
programmed to seek address location 0xfffffff0. This address is mapped to a ROM which
contains a set of instructions known as the BIOS. The BIOS handles low level control
functionality. The BIOS eventually reads the MBR on disk.
The MBR (Master Boot Record) resides on Track 0, Sector 1. It contains the disk
partition table and executable code for the first part of the boot. The MBR resides outside
of the disk partition.
There are two types of boot loaders used by Linux systems ( lilo and GNU GRUB). Both
are divided into two parts. One part resides on the MBR and is used to locate the second
part of the boot loader. The reason for this configuration is because the boot loader is so
large in size. The second part of the boot loader resides outside of the MBR. It resides on
the first sector of the “active” partition known as the Boot Sector. The Boot Sector is one
contiguous piece of information on disk. It cannot be divided or made into pieces,
because the integrity of the software would be compromised. The second part of the boot
loader performs the majority of the work.
After the boot loaders are finished, then the device drivers are loaded. A RAM disk
image is loaded into memory referred to as initrd-2.4.20-8.img. The initrd contains
hardware drivers that are needed to boot the system. After the hardware drivers have been
loaded, the kernel is invocated.
The kernel queries all known devices on the system to see which ones will report back.
Those devices that don’t report back are disabled. The kernel mounts the root partition
read-only. The kernel is responsible for creating init process without the use of the “fork”
command. The kernel creates new processes through a process referred to as
“spontaneous” or “handcrafted”. The processes aren’t created using the traditional “fork”
mechanism.
The init process is created by the kernel “spontaneously”. Its PID is always 0. All other
processes created by the system are siblings of the init process.
At the onset of the computer booting, the system has the following state:
Random values in RAM
CPU mode is set to RESET
CPU is preprogrammed to begin execution at hex address 0Xfffffff0
Address 0Xfffffff0 is mapped to ROM (Read Only Memory)
5
Week Nine Announcements
This ROM address contains a set of routines that are burnt on the chip.
In the x86 these routines in ROM are referred as the BIOS (Basic Input/Output System).
The I/O routines in the BIOS continue the boot process by reading track 0, sector 1 of the
hard disk. This is the location of the MBR. The size of the MBR is 512 bytes. The MBR
contains the disk partition table, and executable code which is the first part of the boot
loader. The MBR is independent of the kernel.
The boot loader is responsible for loading the kernel into memory. Boot loaders are
independent of the operating system and are an executable code found inside the MBR.
The boot loader must share the 512 bytes with the partition table.
lilo boot loader - older
GNU GRUB boot loader – more flexible and can handle multiple operating
systems 9Linux and Windows).
The RAM disk image is loaded into memory. It’s name is initrd. initrd contains a set of
hardware drivers that are used to boot the system. Once the drivers have been loaded,
execution is turned over to the kernel 9/boot/initrd-2.4.20-8.img
The kernel then executes a series of steps.
Memory size determination.
Hardware configuration
Kernel Data Structure Initialization
Mount root partition
Hand crafted init processes.
Hardware Configuration
Configuration is based on kernel configuration information, probing the system
bus, and querying drivers for information. Devices that are missing drivers are
disabled.
Init process
Define the role of init?
init is the parent of all processes. The init process is invoked as the last step
of the kernel boot sequence, it looks for the file /etc/inittab to see if there is an
entry of the type initdefault. The initdefault entry determines the initial runlevel of
the system.
Execute the ps –ef command to display the init process and its pid of one (1) on
Einstein.
What process does not have a parent?
init
System run levels
What are the run levels on a UNIX/Linux system?
A run level is a software configuration of the system which allows only
a selected group of processes to exist. The processes spawned by init
for each of these run levels are defined in the /etc/inittab file. Init
can be in one of eight run levels: 0 or 6 and S or s. The run level is
6
Week Nine Announcements
changed by having a privileged user run telinit, which sends appropriate signals to
init, telling it which run level to change to.
Run levels 0, 1, and 6 are reserved. Run level 0 is used to halt the system, run level 6 is used to reboot the system, and run level 1 is used to
get the system down into single user mode. Run level S is not really
meant to be used directly, but more for the scripts that are executed
when entering run level 1.
S and s are in fact the same. Internally they are
aliases for the same run level.
Kernel Data Structure initialization.
This occurs before processes are allowed to exist.
The kernel mounts the root partition in a read only mode. This is done for error checking
purposes.
The kernel starts a few spontaneous/handcrafted process in the user space. Their origin is
from the kernel and not by the fork and execute procedure. One such process is the init
process. This process has process ID of one (1).
Init process is the ultimate parent in the running system and plays an important role in
the startup process. All future processes on the system are descendents of the init process.
Once the system processes are created, then the kernels work is basically completed
.
Be familiar with the different Linux run levels (0-6).
Shutdown Procedure
5.2 Shutdown
Now and then, every operating system must be shut down. Shutting down any
operating system requires more than simply turning off the computer. Users must be
given the chance to save their work and log off the system; any processes that are
running must be given a chance to gracefully shutdown; any pending disk writes
must be made.
The shutdown command brings the system down in a graceful manner.
This is the preferred way to shutdown your computer at the end of the day as it logs you
out of the computer, clears the system memory of any errors that have developed over the
course of the day, and leave the machine ready for you to login immediately the next day.
It also allows any needed updates to install automatically over the course of the night.
7
Week Nine Announcements
If you do not log out at the end of the day, the next time you use the computer you will
not be able to access your network data or printers until you reboot (all users are
automatically logged out of the network before backups are run each night).
If you only choose the option to logout and login as a different user every night errors
build up in the system over time and cause the computer to work much more slowly and
in some cases fail.
If you choose the option to Shutdown the computer and do not turn the computer back
on, you will have to wait for the computer to boot up, and apply any updates that were set
to run over the course of the night. Our computers are set to enter power saving mode
after 30 minutes of inactivity so they do not waste power when they are not being used.
5.3 Autonomous Processes
There are various processes in UNIX that are not owned by a user, but exist to
provide services. These processes are often called "daemons," after a mythological
creature that could be summoned to perform various tasks. The processes are
started as part of the boot process and run until the system is shut down.
Various daemons are standard in UNIX systems. The cron daemon, for example,
allows you to schedule processes to be executed on a timed basis. The inetd
daemon is the process that manages all TCP/IP connections. One daemon may start
another; inetd, for example, will accept a network connection and then start another
daemon to handle the connection, based on the type of connection. So inetd may
start telnetd to handle a telnet connection, ftpd to handle an ftp connection, etc.
Break-out problems
ps –f highlight the login shell and ps –f command pid and ppid
kill
Terminate a process.
kill -l
The command kill sends the specified signal to the specified process or
process group. As a precaution, avoid indiscriminate use of the kill command on
jobs involving text editors, databases programs, mail programs, or any other
program that has a large amount of user interaction. The kill command
terminates a job without saving any of the user input or program results.
-n option must be a number larger than 1.
Fork-and-exec
The fork command creates a child process. This new process differs from
the parent process by it’s pid and the resource usage which is set to zero.
$$ (Korn Shell) PID of this shell’s process
8
Week Nine Announcements
$! (Korn Shell)
PID of the most recently started background process.
The fork() system call will spawn a new child process which is an identical
process to the parent except that has a new system process ID. The process is
copied in memory from the parent and a new process structure is assigned by
the kernel. The return value of the function is which discriminates the two threads
of execution. A zero is returned by the fork function in the child's process.
The environment, resource limits, umask, controlling terminal, current working
directory, root directory, signal masks and other process resources are also
duplicated from the parent in the forked child process.
df - report filesystem disk space usage
df –l -l, --local
limit listing to local filesystems
sar - Collect, report, or save system activity information.
The sar command writes to standard output the contents of selected
cumulative activity counters in the operating system. The accounting
system, based on the values in the count and interval parameters,
writes information the specified number of times spaced at the specified intervals in seconds.
Download