CSC 205 - 1 Introduction 2023-2024
CSC 205 - 1 Introduction 2023-2024
Dr Wilson Sakpere
Department of Computer Science
Lead City University, Ibadan, Nigeria
- 09137792962; - sakpere.wilson@lcu.edu.ng
Contents
• Class Introduction
Course Objectives
Assessment
Suggested Texts
• Computer System Overview
Top-Level View of Computer Components
Computer System Components
Computer System Organisation
Motherboard
Processor
Multithreading
Multicore Processors
Memory
Disks
I/O Devices
Buses
Booting the Computer
Computer System Operation
2
Course Objectives
• At the end of this course, the student should be able to:
• describe and explain the concepts, structure, design and role
of operating systems.
• describe the impact of operating system design on application
system design and performance.
• demonstrate competency in recognising and using operating
system design and performance.
• demonstrate competency in recognising and using operating
system features.
• explain the performance trade-offs inherent in OS
implementation.
3
Assessment
• Class Attendance 20 marks
• Assignments 10 marks
• Test 10 marks
• Final Examination 60 marks
4
Suggested Texts
• Operating Systems: Design and Implementation, 3rd Edition,
Andrew S. Tanenbaum and Albert S. Woodhull, 2006.
• Operating System Concepts, 10th Edition, Abraham Silberschatz,
Peter Baer Galvin and Greg Gagne, 2018.
• Operating Systems, 3rd Edition, H. M. Deitel, P. J. Deitel and D.
R. Choffnes, 2004.
• Modern Operating Systems, 4th Edition, Andrew S. Tanenbaum
and Herbert Bos, 2015.
• Understanding Operating Systems, 7th Edition, Ann McIver
McHoes and Ida M. Flynn, 2014.
5
Computer System Overview
• An operating system (OS) exploits the hardware resources of
one or more processors to provide a set of services to system
users.
• The OS also manages secondary memory and I/O
(input/output) devices on behalf of its users.
• So, it is important to understand the underlying computer
system hardware before exploring operating systems.
• At a top level, a computer consists of processor, memory, and
I/O components, with one or more modules of each type.
• These components are interconnected to achieve the main
function of the computer, which is to execute programs.
6
Top-Level View of Computer Components
7
Computer System Components
• One of the processor’s functions is to exchange data with memory.
• Thus, it makes use of two internal (to the processor) registers: a memory
address register (MAR), which specifies the address in memory for the
next read or write; and a memory buffer register (MBR), which contains
the data to be written into memory, or receives the data read from
memory.
• Similarly, an I/O address register (I/OAR) specifies a particular I/O
device. An I/O buffer register (I/OBR) is used for the exchange of data
between an I/O module and the processor.
• A memory module consists of a set of locations, defined by sequentially
numbered addresses. Each location contains a bit pattern that can be
interpreted as either an instruction or data.
8
Computer System Components…
• An I/O module transfers data from external devices to processor and
memory, and vice versa. It contains internal buffers for temporarily
storing data until they can be sent on.
9
Computer System Organisation
• There are four main structural elements of the computer system:
• Processor: Controls the operation of the computer and performs its data
processing functions. When there is only one processor, it is often referred
to as the central processing unit (CPU).
• Main memory: Stores data and programs. This memory is typically volatile;
that is, when the computer is shut down, the contents of the memory are
lost. Main memory is also referred to as real memory or primary memory.
• I/O modules: Move data between the computer and its external
environment. The external environment consists of a variety of devices,
including secondary memory devices (e.g., disks), communications
equipment, and terminals.
• System bus: Provides communication among processors, main memory,
and I/O modules.
10
Computer System Organisation…
• One or more CPUs, device controllers connect through common bus providing
access to shared memory.
• Concurrent execution of CPUs and devices competing for memory cycles.
11
Motherboard
12
Processor
• The ‘‘brain’’ of the computer is the Central Processing Unit (CPU). Multiple CPUs
is referred to as processor. The CPU fetches instructions from memory and
executes them. The basic cycle of every CPU is to fetch the first instruction from
memory, decode it to determine its type and operands, execute it, and then
fetch, decode, and execute subsequent instructions. The cycle is repeated until
the program finishes. In this way, programs are carried out.
• Each CPU has a specific set of instructions that it can execute. Thus, an x86
processor cannot execute ARM programs and an ARM processor cannot
execute x86 programs. Because accessing memory to get an instruction or data
word takes much longer than executing an instruction, all CPUs contain some
registers inside to hold key variables and temporary results. Thus, the
instruction set generally contains instructions to load a word from memory into
a register and store a word from a register into memory. Other instructions
combine two operands from registers, memory, or both into a result, such as
adding two words and storing the result in a register or in memory.
13
Processor…
• Also, most computers have several special registers that are visible to the
programmer. One of these is the program counter, which contains the memory
address of the next instruction to be fetched. After that instruction has been
fetched, the program counter is updated to point to its successor.
• Another register is the stack pointer, which points to the top of the current stack
in memory. The stack contains one frame for each procedure that has been
entered but not yet exited. A procedure’s stack frame holds those input
parameters, local variables, and temporary variables that are not kept in registers.
• Yet another register is the Program Status Word (PSW). This register contains the
condition code bits, which are set by comparison instructions, the CPU priority,
the mode (user or kernel), and various other control bits. User programs may
normally read the entire PSW but typically may write only some of its fields. The
PSW plays an important role in system calls and I/O.
14
Processor…
• When time multiplexing the CPU, the operating system will often stop the
running program to (re)start another one. Every time it stops a running
program, the operating system must save all the registers so they can be
restored when the program runs later.
• To improve performance, CPU designers have long abandoned the simple
model of fetching, decoding, and executing one instruction at a time. Many
modern CPUs have facilities for executing more than one instruction at the
same time. For example, a CPU might have separate fetch, decode, and
execute units, so that while it is executing instruction n, it could also be
decoding instruction n + 1 and fetching instruction n + 2. Such an organisation
is called a pipeline. In most pipeline designs, once an instruction has been
fetched into the pipeline, it must be executed, even if the preceding
instruction was a conditional branch that was taken.
15
Processor…
• A superscalar CPU has multiple execution units, for example, one for
integer arithmetic, one for floating-point arithmetic, and one for
Boolean operations.
A quad-core chip with a shared L2 cache A quad-core chip with separate L2 caches
20
Multicore Processors…
• Some processors, like Intel Xeon Phi and the Tilera TilePro, already
have more than 60 cores on a single chip.
• Making use of such a multicore chip will definitely require a
multiprocessor operating system with a modern Graphics Processing
Unit (GPU).
• A GPU is a processor with thousands of tiny cores. They are very good
for many small computations done in parallel, like rendering polygons
in graphics applications.
• They are not so good at serial tasks. They are also hard to program.
While GPUs can be useful for operating systems (e.g., encryption or
processing of network traffic), it is not likely that much of the
operating system itself will run on the GPUs.
21
Memory
• The second major component in any computer is the memory. The memory
should be extremely fast (faster than executing an instruction so that the CPU
is not held up by the memory), abundantly large, and cheap. No current
technology satisfies all of these goals, so a different approach is taken. The
memory system is constructed as a hierarchy of layers, as shown below.
23
Cache Memory
• The cache memory is mostly controlled by the hardware. Main memory
is divided up into cache lines, typically 64 bytes, with addresses 0 to 63
in cache line 0, 64 to 127 in cache line 1, 128 to 191 in cache line 2, and
so on. The most heavily used cache lines are kept in a high-speed cache
located inside or very close to the CPU.
• When the program needs to read a memory word, the cache hardware
checks to see if the line needed is in the cache. If it is, called a cache hit,
the request is satisfied from the cache and no memory request is sent
over the bus to the main memory.
• Cache hits normally take about two clock cycles. Cache misses have to
go to memory, with a substantial time penalty. Cache memory is limited
in size due to its high cost. Some machines have two or even three levels
of cache, each one slower and bigger than the one before it.
24
Cache Memory…
• Caching plays a major role in many areas of computer science, not just
caching lines of RAM. Whenever a resource can be divided into pieces,
some of which are used much more heavily than others, caching is often
used to improve performance.
• Operating systems use it all the time. For example, most operating
systems keep (pieces of) heavily used files in main memory to avoid
having to fetch them from the disk repeatedly. Similarly, the results of
converting long path names like into the disk address where the file is
located can be cached to avoid repeated lookups.
• Finally, when the address of a Web page (URL) is converted to a network
address (IP address), the result can be cached for future use. Many
other uses exist.
25
Cache Memory…
• Caches are such a good idea that modern CPUs have two of them. The first
level or L1 cache is always inside the CPU and usually feeds decoded
instructions into the CPU’s execution engine. Most chips have a second L1
cache for very heavily used data words. The L1 caches are typically 16 KB
each. In addition, there is often a second cache, called the L2 cache, that
holds several megabytes of recently used memory words. The difference
between the L1 and L2 caches lies in the timing. Access to the L1 cache is
done without any delay, whereas access to the L2 cache involves a delay of
one or two clock cycles.
• On multicore chips, the designers must decide where to place the caches.
From Figure (a) in slide 20, a single L2 cache is shared by all the cores. This
approach is used in Intel multicore chips. In Figure (b), each core has its own
L2 cache. This approach is used by AMD. Each strategy has its pros and cons.
For example, the Intel shared L2 cache requires a more complicated cache
controller but the AMD way makes keeping the L2 caches consistent more
difficult.
26
Main Memory
• Main memory is the workhorse of the memory system. It is usually called
Random Access Memory (RAM), and core memory in some quarters. All CPU
requests that cannot be satisfied out of the cache go to main memory. In
addition to the main memory, many computers have a small amount of
nonvolatile random-access memory. Unlike RAM, nonvolatile memory does
not lose its contents when the power is switched off.
• Read Only Memory (ROM) is programmed at the factory and cannot be
changed afterward. It is fast and inexpensive. On some computers, the
bootstrap loader used to start the computer is contained in ROM. Also, some
I/O cards come with ROM for handling low-level device control.
• Electrically Erasable Programmable ROM (EEPROM) and flash memory are
also nonvolatile, but in contrast to ROM can be erased and rewritten.
However, writing them takes orders of magnitude more time than writing
RAM, so they are used in the same way ROM is, only with the additional
feature that it is now possible to correct bugs in programs they hold by
rewriting them in the field.
27
Main Memory…
• Flash memory is also commonly used as the storage medium in portable
electronic devices. It serves as film in digital cameras and as the disk in
portable music players, to name just two uses. Flash memory is intermediate
in speed between RAM and disk. If it is erased too many times, it wears out.
• Another kind of memory is Complementary Metal–Oxide–Semiconductor
(CMOS), which is volatile. Many computers use CMOS memory to hold the
current time and date. The CMOS memory and the clock circuit that
increments the time in it are powered by a small battery, so the time is
correctly updated, even when the computer is unplugged. The CMOS memory
can also hold the configuration parameters, such as which disk to boot from.
CMOS is used because it draws so little power that the original factory-
installed battery often lasts for several years. However, when it begins to fail,
the computer can appear to have Alzheimer’s disease, forgetting things that it
has known for years, like which hard disk to boot from.
28
Disks
• Disk storage is cheaper than RAM and larger as well. The only problem is that
the time to randomly access data on it is slower. The reason is that a disk is a
mechanical device.
39
Booting the Computer
• Every PC contains a motherboard. On the motherboard is a program
called the system BIOS (Basic Input Output System). The BIOS contains
low-level I/O software, including procedures to read the keyboard, write
to the screen, and do disk I/O, among other things. Nowadays, it is held
in a flash RAM, which is nonvolatile, but can be updated by the
operating system when bugs are found in the BIOS.
• When the computer is booted, the BIOS is started. It first checks to see
how much RAM is installed and whether the keyboard and other basic
devices are installed and responding correctly. It starts out by scanning
the PCIe and PCI buses to detect all the devices attached to them. If the
devices present are different from when the system was last booted, the
new devices are configured.
40
Booting the Computer…
• The BIOS then determines the boot device by trying a list of devices stored in the
CMOS memory. The user can change this list by entering a BIOS configuration program
just after booting. Typically, an attempt is made to boot from a CD-ROM (or
sometimes USB) drive, if one is present. If that fails, the system boots from the hard
disk. The first sector from the boot device is read into memory and executed. This
sector contains a program that normally examines the partition table at the end of the
boot sector to determine which partition is active. Then a secondary boot loader is
read in from that partition. This loader reads in the operating system from the active
partition and starts it.
• The operating system then queries the BIOS to get the configuration information. For
each device, it checks to see if it has the device driver. If not, it asks the user to insert
a CD-ROM containing the driver (supplied by the device’s manufacturer) or to
download it from the Internet. Once it has all the device drivers, the operating system
loads them into the kernel. Then it initialises its tables, creates whatever background
processes are needed, and starts up a login program or GUI.
41
Computer System Operation
• I/O devices and the CPU can execute concurrently.
• Each device controller manages a particular device type.
• Each device controller has a local buffer.
• Each device controller type has an operating system device driver to
manage it.
• CPU moves data from/to main memory to/from local buffers.
• I/O is from the device to local buffer of controller.
• Device controller informs CPU that it has finished its operation by
causing an interrupt.
42
Homework 1
• Discuss the various types of operating systems that we
may have.
43
www.citysourced.com
44