OS
Software development will involve creating things, saving, editing and saving the same thing
It is important for software development to save the same thing again. Many developments
will be involved, and version control can help. Version control can mean changes can be
reviewed, and even undone if need be
Sharing your code with others is very inefficient without a management system like GIT
Version control records changes to a file or set of files. It can allow a timeline to be built of
your code, key features such as backup and restore are all possible. Also allows
synchronization between different people. Sandboxing can keep your system safe while you
make changes in an isolated environment
All code needs to be version controlled, all code will need to be uploaded to git
Git init creates a new directory, git clone creates a copy.
Git add allows for changes, git commit then confirms the changes to the index. -m for
commit allows for adding a message of why said change was made
Git push sends the changes to the remote repository
Branches are used to develop features, and can be merged together.
Git pull updates your code to the newest code
An OS is low level software, that allows management of software and hardware. Essentially,
it allows the computer to “work”. Without an OS, you would only be able to use BIOS
Variety of OS’s: Computer, network, mobile, embedded, IoT and real-time
Services that are provided are program execution, I/O operations, communications, file
systems, error detections, accounting and security
Lecture 2:
If any programme trys to damage the OS, the OS will kill the programme to prevent any
errors
An OS can provide programming simplicity since the programmer does not need to know
how hardware works.
A program thinks it owns the machine, to allow for concurrent use of resources. This means
that 100 programs can run at the same time with resources being shared
OS will have millions of lines of code
Manages the hardware, so the user does not need to know the complexity of hardware
management
The main goal of an OS is for simple execution of programs and making solving user
problems simpler. It makes hardware more versatile since it can run on different hardware
Another goal of an OS to improve reliability and isolation for programs
Hardware is linked together by a system bus: CPU, disk controller, USB controller, GPU, and
memory. The memory is controlled by a memory controller
A soft interrupt can even be a notification from an email
2 different inputs: the CLI and GUI
The CLI is for direct command entry and is just text. GUI is much easier to use and is a much
more user friendly interface.
An OS uses kernel modules. Uses object orientated approach, and each module is loaded is
when needed.
Modules can communicate with each other
Multiprogramming is the concept of having multiple jobs loaded in the memory
I/O is overlapped, while one programme waits for I/O the other will use the CPU.
, An interrupt happens with I/O, such as a button press
An interrupt is more efficient then polling, although they are both used
Timeslicing is the content of diving CPU among users
Parallel systems speed up the execution of programmes by running threads/processes on
multiple CPUs
Parallel computing can be seeing in clusters like google or amazon, as well as modern GPUs
System calls are calls to the operating system
A bootstrap loader locates the kernel, loads it into memory and starts it
Lecture 3:
Hardware includes architecture as well as components
Address bus is only used to locate the device/particular chip. It is single way
Control bus only transfers control signals. It can send signals to write to an I/O device or
send signals to read from memory. It is also single way
Data bus is for data. It is multi directional. The cpu can read from memory or IO device, and
can write data from CPU to memory or IO device. Usually sends multiples of 8
The processor communicates directly with memory and IO device
Is small embedded systems, the busses may be integrated in to the CPU
I/O device is usually very slow, so a DMAC is used to control it. It will have the source and
destination addresses.
BIOS is stored in rom
An example for accessing ram is the address and control signals are set, the RAM chip
fetches the location, and the data is then sent to the data busses
A cache can store recently accessed instructions
A hub chip can organise signals, although it is not always used
The CPU fetches instructions from the memory based on the clock speed.
The programme counter register stores next instruction address. Most important register.
Also called instruction pointer.
The instructions are fetched, the then decoded, and they are then executed.
CPU can only execute one instruction at a time It can however fetch and decode at the same
in a “pipeline”. This improves performance
RISC means reduced instruction set computer. CICS is complex instruction set computer
RISC is simple, CISC is more complex with powerful instructions
Front side bus or FSB links a memory controller, bridge and GPU to the processor
ISA links to the I/O device
Typically 2 bridges
North bridge is high seed, for memory and GPU
South bridge is slow, usually just for I/O device (USB, PCI etc)
Memory controller hub and IO hub often replace north and south bridge name (Intel)
AMD architecture the CPU is linked directly with the RAM, and it uses a hyper transport bus
to connect to a north bridge for GPU etc.
Each core has a cache, used to store frequently used data or instructions
3 levels of cache. Level 1 is induvial, 2 is usually shared but some can have inbuilt
Multiple general and special purpose registers. Program counter stores next instruction
execute. Stack pointer shows address of active stack frame. Processor status register shows
the status of the CPU
Registers, cache, and main memory are often smaller, expensive and very fast. Discs are
slower but much cheaper
, ARM processors are dominant in mobile devices
I/O devices can often cause bottlenecks. DMAC is one way to get around this, or interrupts
When an I/O device is ready to send a signal, an interrupt is sent. Very efficient, and it means
the cpu only responds to I/O devices when there is a request
IRQ is interrupt request, once received the CPU will stop the task it’s doing to handle the IO.
It does this through a ISR or interrupt service routine/handler. Once done, it returns to the
main task
An interrupt needs to execute as quickly as possible, and code needs to make sure that it can
be interrupted
An interrupt controller manages interrupts. It provides things like prioritisation
An interrupt list contains interrupts and external events which have a fixed address (vectors)
A stack is an area of RAM that uses last in last out and is used for dynamic variables.
Examples can be local variables and subroutine
Polling is an alternative to vectors, and is a loop checking if something is ready or not
Lecture 4:
Multiple chips can be connected to deal with more interrupts
An I/O interrupt can be multiple things, such as an I/O device receiving a new character, or
the system voltage has gone bellow a safe level
The CPU will finish the current instruction before executing the interrupt response. Status
will be saved, and it will jump to the interrupt service routine.
A interrupt vector can be an address where the code resides for the interrupt service
routine, or an address that holds the address of the ISR
A stack is an area of RAM and operates on last in first out memory dynamic.
Used to store dynamic generated data
Certain registers can get pushed to the stack too.
Polling is just a loop checking if the event happened, and it is highly inefficient.
An interrupt controller is used to manage the multitude of interrupts
Concurrency simply means that each process is dealt with one at a time, each application
feels like it owns the CPU.
A time slice is allocated to each process 5ms-800ms.
PCB means process control block and keeps basic processor states (registers, main memory
etc)
5 stages to a process execute: new, ready, running, waiting and terminated.
C programmes run the first instruction the follow the sequence, demonstrating a sequential
model.
Program is just part of process state. Many users can run the same program, and have
different variables.
Each process is programmed with it’s own idea of time
Stack and heap are both dynamically allocated memory
Global variables are not good as static data will take to much space
In unix operating systems, parent processes create child processes
Usually the parent and the child share all the of the resources
The processes execute concurrently, and you can not terminate the parent until all the
children have been terminated
Exec used after a fork replaces the process memory space with a new program.
The parent init will fork processes like login. Bash’s parent is login, but it can fork child
processes like ls.