100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CS2850: Operating Systems Lecture Notes $13.29   Add to cart

Class notes

CS2850: Operating Systems Lecture Notes

 12 views  0 purchase
  • Course
  • Institution

My study notes for the whole CS2850 module that took place at Royal Holloway, University of London. This is for the theory part of it - with topics including Processes and Threads, IPC with and without busy waiting, CPU scheduling, Interactive System Scheduling, and all taught algorithms related to...

[Show more]

Preview 4 out of 51  pages

  • June 27, 2023
  • 51
  • 2022/2023
  • Class notes
  • Dr matteo sammartino
  • All classes
  • Unknown
avatar-seller
Week 1

Operating Systems
-Created to act as a layer between end user applications and the hardware




Kernel mode allows all instructions whereas user mode only allows a specific set


CPU
● Has a specific instruction set
● Fetches instructions from memory and executes them
● Uses registers for storing temporary values and control information - super fast
access

Modern CPU’s use a pipeline in order to increase performance meaning while executing an
instruction, the next can be decoded and the following one fetched.



Superscalar CPUs have multiple units of the same type. Allows for multiple operations at the
same time.




CPU power has increased due to:
● Ability to keep shrinking transistor size
● Multithreading - allows different tasks to take place in a CPU and allows these tasks
to be switched between. Eg if one is waiting for a value from memory
● Multicore - CPUs have several cores

,Memory




Main memory - RAM (volatile - loses data when power source is lost)
Magnetic disk - HDD

Two levels of cache
-Level 1 resides inside the CPU
-Level 2 is larger than L1 but slower. It can be assigned to a specific core or shared
Problems with cache include:
When you want to add a new item, which item should you remove?
Where to put this newly evicted item into the larger memory?


I/O Devices
● Consists of a controller and the device
● Controller is a hardware component that accepts commands from the OS
● Each controller is different so to minimise OS complexity, they use a device driver
● The vendors of the hardware creates the device driver


Interrupts
● A signal sent to the CPU to alert attention.
● Interrupt controller (physically attached to the CPU) is a chip that handles several
devices. It will assert a pin on the CPU chip if it is ready to accept the interrupt. (step
3) It puts the number of the device on the bus for the CPU to read it and know what
device has finished. (step 4)
Interrupt processing involves taking the interrupt, running the interrupt handler and returning
to the user program. When the CPU accepts the interrupt, the currently running program is
suspended and the CPU is switched to kernel mode.

,How can I/O take place?
Busy Waiting
1. Program issues a system call
2. The OS translates the call to the device driver
3. Driver initiates I/O and continuously polls the device to check if the operation has
been completed
4. Once it’s complete, it returns any result and the OS passes it to the original caller
Main disadvantage of this is the CPU is tied up during the polling process

Alternative
● Device driver to initiate a request to the device and ask to be notified when the
operation is finished.
● Whilst the device is completing the operation, the OS can block the original caller and
do other work.
● When the controller detects the end of the original operation, it generates an
interrupt.

Direct Memory Access (DMA)
● A chip that can get instructions from the CPU (number of bytes to transfer, direct and
memory addresses involved)
● When the DMA chip completes the operation, it will generate an interrupt
● Further minimises CPU intervention



OS Concepts
Process - A program in execution
-Associated with an address space and a set of resources
-Processes can create child processes and these can be shown in a tree diagram
Mounting in UNIX - Adding an external file to the root file so it is part of the file hierarchy


Week 2

Processes
The OS keeps a common set of data for a process:
● Process ID
● Process name
● User running the program
● Executable file associated with the process
● Current values of the registers, variables and program counter

In a multiprogramming system, a CPU quickly switches from process to process. Although
the CPU is only running one process at a time, this gives the illusion of parallelism. Called
pseudo-parallelism. There is only one program counter in the CPU.

, Process Creation
● System initialisation - on system startup
● Execution of a process creation system call by a running process
● A user request to create a new process
● Initiation of a batch job - happens in mainframes where users submit jobs and the OS
will select a job from the input and create a process-

POSIX (Portable Operating System Interface for UNIX)
● A new process is created by a system call called fork
● It creates a clone of the calling process, called the “child process”
○ Shares same memory, resources
○ Address space is separate (if a var gets changed in the child, parent does not
change)
● fork() returns twice
○ Parent process returns the child process id
○ Child process returns 0

Windows
● Process is created in a single step called CreateProcess call
● The process is created and initiates the execution of a program


Process Termination
● Normal exit (voluntary) - process finishes work
● Error exit (voluntary) - exit due to an error handled by the program itself
● Fatal Error (involuntary) - error caused by the process
● Killed by another process (involuntary)


Process Types
● Interact directly with users independently of how they started
○ Eg file explorer, web browser
● Daemons - working in the background and react to occurrences
○ Eg process checking for OS updates


Process States
1. Running - process is using the CPU right now
2. Ready - runnable, temporarily stopped to let another process run
3. Blocked - unable to run until some external event to happen

1 happens when a process is waiting for
something else to continue eg I/O input
2 occurs when the scheduler decides a process
has ran long enough
3 occurs when a process can use the CPU again
4 occurs when the event the process was waiting
for happens

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller amyengelbrecht. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.29. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79271 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.29
  • (0)
  Add to cart