0% found this document useful (0 votes)
92 views4 pages

Unit-1 and Swayam Week 1 and Week 2 Revision Unit-1 Course Contents

This document provides an overview of system calls, system components, threads, and x86 architecture. It discusses: 1) What system calls are and examples of services they provide like process creation, memory management, I/O handling. 2) Common OS system components like processes, memory management, I/O device handling that are found across OSs. 3) Details on threads, their advantages over processes, and types of threads. 4) Key aspects of x86 architecture like the von Neumann model, control unit, ALU, instruction set, and GCC calling conventions.

Uploaded by

Abhinav arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views4 pages

Unit-1 and Swayam Week 1 and Week 2 Revision Unit-1 Course Contents

This document provides an overview of system calls, system components, threads, and x86 architecture. It discusses: 1) What system calls are and examples of services they provide like process creation, memory management, I/O handling. 2) Common OS system components like processes, memory management, I/O device handling that are found across OSs. 3) Details on threads, their advantages over processes, and types of threads. 4) Key aspects of x86 architecture like the von Neumann model, control unit, ALU, instruction set, and GCC calling conventions.

Uploaded by

Abhinav arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

UNIT-1 AND SWAYAM WEEK 1 AND WEEK 2 REVISION

UNIT-1 COURSE CONTENTS


 System Call
system call is the programmatic way in which a computer program requests a service from the kernel of
the operating system it is executed on. A system call is a way for programs to interact with the
operating system. A computer program makes a system call when it makes a request to the operating
system’s kernel. System call provides the services of the operating system to the user programs via
Application Program Interface(API). It provides an interface between a process and operating system to
allow user-level processes to request services of the operating system. System calls are the only entry
points into the kernel system. All programs needing resources must use system calls.
Services Provided by System Calls:
1. Process creation and management
2. Main memory management
3. File Access, Directory and File system management
4. Device handling(I/O)
5. Protection
6. Networking, etc.
 System Components

 An operating system is a large and complex system that can only be created by partitioning into
small pieces. These pieces should be a well-defined portion of the system, which carefully
defined inputs, outputs, and functions.

 Although Mac, Unix, Linux, Windows, and other OS do not have the same structure, most of the
operating systems share similar OS system components like File, Process, Memory, I/O device
management.

WEEK 1: LECT 1 & LECT 2


Unix system call: The interface between a process and an operating system is provided by system calls.
In general, system calls are available as assembly language instructions. They are also included in the
manuals used by the assembly level programmers.
Unix System Calls: System calls in Unix are used for file system control, process control, interprocess
communication etc. Access to the Unix kernel is only available through these system calls. Generally,
system calls are similar to function calls, the only difference is that they remove the control from the user
process. The kernel determines whether there was an error. If so, it adjusts register locations in the saved
user register context, typically setting the "carry" bit for the PS (processor status) register and copying the
error number into register 0 location. If there were no errors in the execution of the system call, the
kernel clears the "carry" bit in the PS register and copies the appropriate return values from the system
call into the locations for registers 0 and 1 in the saved user register context. When the kernel returns
from the operating system trap to user mode, it returns to the library instruction after the trap instruction.
The library interprets the return values from the kernel and returns a value to the user program.
WEEK 1: LECT 3
Threads: A thread is a path of execution within a process. A process can contain multiple threads.
Why Multithreading?
A thread is also known as lightweight process. The idea is to achieve parallelism by dividing a process
into multiple threads. For example, in a browser, multiple tabs can be different threads. MS Word uses
multiple threads: one thread to format the text, another thread to process inputs, etc. More advantages of
multithreading are discussed below
Process vs Thread?
The primary difference is that threads within the same process run in a shared memory space, while
processes run in separate memory spaces.
Threads are not independent of one another like processes are, and as a result threads share with other
threads their code section, data section, and OS resources (like open files and signals). But, like process, a
thread has its own program counter (PC), register set, and stack space.
Advantages of Thread over Process
1. Responsiveness: If the process is divided into multiple threads, if one thread completes its execution,
then its output can be immediately returned.
 2. Faster context switch: Context switch time between threads is lower compared to process
context switch. Process context switching requires more overhead from the CPU.
 3. Effective utilization of multiprocessor system: If we have multiple threads in a single process,
then we can schedule multiple threads on multiple processor. This will make process execution faster.

Types of Threads
There are two types of threads.
User Level Thread
Kernel Level Thread

 Address space: The range of virtual addresses that the operating system assigns to a user or separately
running program is called an address space. This is the area of contiguous virtual addresses available
for executing instructions and storing data.
With multiple virtual address spaces, errors are confined to one address space, except for errors in
commonly addressable storage, thus improving system reliability and making error recovery easier.
Programs in separate address spaces are protected from each other. Isolating data in its own address
space also protects the data.
 File system devices
A file system or file system controls how data is stored and retrieved. Without a file system, data placed
in a storage medium would be one large body of data with no way to tell where one piece of data stops
and the next begins. By separating the data into pieces and giving each piece a name, the data is easily
isolated and identified. Taking its name from the way paper-based data management system is named,
each group of data is called a file. The structure and logic rules used to manage the groups of data and
their names is called a file system device.
File system types can be classified into: -
1. Disk/tape file systems.
2. Network file systems.
3. Special-purpose file systems.

 WEEK 2: LECT 1:
The interface between a computer’s hardware and its software is its architecture. The architecture is
described by what the computer’s instructions do, and how they are specified. Understanding how it all
works requires knowledge of the structure of a computer and its assembly language.
The computer is in a sense a communication system. Data is constantly being moved between the CPU,
memory and the various devices. The CPU uses I/O addresses to direct data to particular devices. The
devices in turn use interrupts to notify the CPU and operating system of their needs.
The von Neumann Architecture:
1. A von Neumann architecture machine, designed by physicist and mathematician John von
Neumann (1903–1957) is a theoretical design for a stored program computer that serves as the basis for
almost all modern computers. A von Neumann machine consists of a central processor with an
arithmetic/logic unit and a control unit, a memory, mass storage, and input and output.
The CPU Control Unit:
The control unit (CU) is a component of a computer's central processing unit (CPU) that directs
operation of the processor. It tells the computer's memory, arithmetic/logic unit and input and output
devices how to respond to a program's instructions Coordinates the parts of the CPU.
The Arithmetic Logic Unit (ALU):
An arithmetic logic unit (ALU) is a digital circuit used to perform arithmetic and logic operations. It
represents the fundamental building block of the central processing unit (CPU) of a computer. Modern
CPUs contain very powerful and complex ALUs. In addition to ALUs, modern CPUs contain a control
unit
All information in a computer is stored and manipulated in the form of binary numbers, i.e. 0 and 1.
Transistor switches are used to manipulate binary numbers since there are only two possible states of a
switch: open or closed. An open transistor, through which there is no current, represents a 0. A closed
transistor, through which there is a current, represents a 1.
 WEEK 2: LECT 2 X86:
Instruction Set:
 The x86 instruction set refers to the set of instructions that x86-compatible microprocessors
support. ...
 The x86 instruction set has been extended several times, introducing wider registers and
datatypes as well as new functionality.
 This is the full 8086/8088 instruction set of Intel.
GCC Calling convention:

o x86 dictates that stack grows down:

Example instruction What it does


subl $4, %esp
pushl %eax
movl %eax, (%esp)
movl (%esp), %eax
popl %eax
addl $4, %esp
pushl %eip (*)
call 0x12345
movl $0x12345, %eip (*)
ret popl %eip (*)

o (*) Not real instructions


o Use example of a function foo() calling a function bar() with two arguments. Assume that
bar returns the sum of the two arguments; write bar's code in C and assembly, and explain
the conventions.
o Formally, introduce the conventions. GCC dictates how the stack is used. Contract
between caller and callee on x86:
 at entry to a function (i.e. just after call):
 %eip points at first instruction of function
 %esp+4 points at first argument
 %esp points at return address

There are often subtle differences in how various compilers implement these conventions, so it is often
difficult to interface code which is compiled by different compilers. On the other hand, conventions
which are used as an API standard (such as stdcall) are very uniformly implemented.

You might also like