Overview of System Structure and Process Modeling

undefined
BINA RAMAMURTHY
System Structure and Process
Model
2/28/2025
cse321-spring2014
1
 
Traditional unix structure
System call
Standard C libraries
2/28/2025
cse321-spring2014
2
undefined
Page 3
Traditional UNIX System Structure
2/28/2025
cse321-spring2014
2/28/2025
cse321-spring2014
4
System Call
There are 11 steps in making the system call
                 read (fd, buffer, nbytes)
undefined
Page 5
API – System Call – Operating system
Relationship
2/28/2025
cse321-spring2014
undefined
Page 6
Standard C Library Example
C program invoking printf() library call, which calls
write() system call
2/28/2025
cse321-spring2014
Pag
e 7
What is a process?
A process is simply a program in execution: an instance of a program
execution.
Unit of work individually schedulable by an operating system (OS).
A process includes:
program counter
stack
data section
OS keeps track of all the active processes and allocates system
resources to them according to policies devised to meet design
performance objectives.
To meet process requirements OS must maintain many data
structures efficiently.
The process abstraction is a fundamental OS means for management
of concurrent program execution. Example: instances of process  co-
existing.
2/28/2025
cse321-spring2014
undefined
Page
8
Process in Memory
2/28/2025
cse321-spring2014
text=code
Where is my data stored?
2/28/2025
cse321-spring2014
9
Global varaibles 
 data
Static variables 
 data
Constant data type 
 data/code
Local variables (in functions as well as in main)
 stack
Pointers (ex: int * id, float * arr) 
 on the stack
Dynamically allocated space (using malloc, calloc) 
pointers on stack, space on heap
How do you pass parameters?
2/28/2025
cse321-spring2014
10
By placing the parameters in specific registers
By placing parameters on the stack
By placing the parameters in general memory  area
Pag
e 11
Process control
Process creation in unix is by means of the system call fork().
OS in response to a fork() call:
Allocate slot in the process table for new process.
Assigns unique pid to the new process..
Makes a copy of the process image, except for the shared
memory.
both child and parent are executing the same code
following fork()
Move child process to Ready queue.
it returns pid of the child to the parent, and a zero
value to the child
.
2/28/2025
cse321-spring2014
Pag
e 12
Process control (contd.)
All the above are done in the kernel mode in the process
context. When the kernel completes these it does one of the
following as a part of the dispatcher:
Stay in the parent process. Control returns to the user
mode at the point of the fork call of the parent.
Transfer control to the child process. The child process
begins executing at the same point in the code as the
parent, at the return from the fork call.
Transfer control another process leaving both parent and
child in the Ready state.
2/28/2025
cse321-spring2014
undefined
Page
13
Process Creation (contd.)
Parent 
process create 
children 
processes, which, in turn create other
processes, forming a tree of processes
Generally, process identified and managed via 
a process identifier
(
pid
)
Resource sharing
Parent and children share all resources
Children share subset of parent’s resources
Parent and child share no resources
Execution
Parent and children execute concurrently
Parent waits until children terminate
2/28/2025
cse321-spring2014
undefined
Page
14
Process Creation (Contd.)
Address space
Child duplicate of parent
Child has a program loaded into it
UNIX examples
fork
 system call creates new process
exec
 system call used after a 
fork
 to replace the process’
memory space with a new program
2/28/2025
cse321-spring2014
undefined
Page
15
Process Creation (contd.)
2/28/2025
cse321-spring2014
Pag
e 16
A five-state process model
Five states: New,  Ready,  Running,  Blocked,  Exit
New
 :  A process has been created but has not yet been
admitted to the pool of executable processes.
Ready
 : Processes that are prepared to run if given an
opportunity. That is, they are not waiting on anything
except the CPU availability.
Running
: The process that is currently being executed.
(Assume single processor for simplicity.)
Blocked 
: A process that cannot execute until a specified
event such as an IO completion occurs.
Exit
: A process that has been released by OS either after
normal termination or after abnormal termination (error).
2/28/2025
cse321-spring2014
Pag
e 17
State Transition Diagram
NEW
READY
RUNNING
BLOCKED
EXIT
Admit
Dispatch
Time-out
Release
Event 
Wait
Event 
Occurs
Think of the conditions under which state transitions may take place.
2/28/2025
cse321-spring2014
Pag
e 18
Process creation - Example
main () {
  int pid;
  cout << “ just one process so far”<<endl;
  pid = fork();
  if (pid == 0)
    cout <<“I am the child “<< endl;
  else if (pid > 0)
     cout <<“I am the parent”<< endl;
   else
     cout << “fork failed”<< endl;}
2/28/2025
cse321-spring2014
2/28/2025
cse321-spring2014
19
System Calls For Process Management and
File Management
 
Slide Note
Embed
Share

This content delves into the intricacies of system structure and process modeling, covering topics such as traditional UNIX structure, system calls, processes in memory, data storage, parameter passing, and more. Explore the fundamental concepts and relationships between system components to enhance your understanding of operating systems.

  • System structure
  • Process modeling
  • Operating systems
  • Data storage
  • Parameter passing

Uploaded on Feb 28, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. System Structure and Process Model 1 BINA RAMAMURTHY 2/28/2025 cse321-spring2014

  2. 2 Traditional unix structure System call Standard C libraries 2/28/2025 cse321-spring2014

  3. Traditional UNIX System Structure Page 3 2/28/2025 cse321-spring2014

  4. System Call 4 There are 11 steps in making the system call read (fd, buffer, nbytes) 2/28/2025 cse321-spring2014

  5. API System Call Operating system Relationship Page 5 2/28/2025 cse321-spring2014

  6. Standard C Library Example C program invoking printf() library call, which calls write() system call Page 6 2/28/2025 cse321-spring2014

  7. What is a process? Pag e 7 A process is simply a program in execution: an instance of a program execution. Unit of work individually schedulable by an operating system (OS). A process includes: program counter stack data section OS keeps track of all the active processes and allocates system resources to them according to policies devised to meet design performance objectives. To meet process requirements OS must maintain many data structures efficiently. The process abstraction is a fundamental OS means for management of concurrent program execution. Example: instances of process co- existing. 2/28/2025 cse321-spring2014

  8. Process in Memory text=code Page 8 2/28/2025 cse321-spring2014

  9. Where is my data stored? 9 Global varaibles data Static variables data Constant data type data/code Local variables (in functions as well as in main) stack Pointers (ex: int * id, float * arr) on the stack Dynamically allocated space (using malloc, calloc) pointers on stack, space on heap 2/28/2025 cse321-spring2014

  10. How do you pass parameters? 10 By placing the parameters in specific registers By placing parameters on the stack By placing the parameters in general memory area 2/28/2025 cse321-spring2014

  11. Process control Pag e 11 Process creation in unix is by means of the system call fork(). OS in response to a fork() call: Allocate slot in the process table for new process. Assigns unique pid to the new process.. Makes a copy of the process image, except for the shared memory. both child and parent are executing the same code following fork() Move child process to Ready queue. it returns pid of the child to the parent, and a zero value to the child. 2/28/2025 cse321-spring2014

  12. Process control (contd.) Pag e 12 All the above are done in the kernel mode in the process context. When the kernel completes these it does one of the following as a part of the dispatcher: Stay in the parent process. Control returns to the user mode at the point of the fork call of the parent. Transfer control to the child process. The child process begins executing at the same point in the code as the parent, at the return from the fork call. Transfer control another process leaving both parent and child in the Ready state. 2/28/2025 cse321-spring2014

  13. Process Creation (contd.) Parent process create children processes, which, in turn create other processes, forming a tree of processes Generally, process identified and managed via a process identifier (pid) Resource sharing Parent and children share all resources Children share subset of parent s resources Parent and child share no resources Execution Parent and children execute concurrently Parent waits until children terminate Page 13 2/28/2025 cse321-spring2014

  14. Process Creation (Contd.) Address space Child duplicate of parent Child has a program loaded into it UNIX examples fork system call creates new process exec system call used after a forkto replace the process memory space with a new program Page 14 2/28/2025 cse321-spring2014

  15. Process Creation (contd.) Page 15 2/28/2025 cse321-spring2014

  16. A five-state process model Pag e 16 Five states: New, Ready, Running, Blocked, Exit New : A process has been created but has not yet been admitted to the pool of executable processes. Ready : Processes that are prepared to run if given an opportunity. That is, they are not waiting on anything except the CPU availability. Running: The process that is currently being executed. (Assume single processor for simplicity.) Blocked : A process that cannot execute until a specified event such as an IO completion occurs. Exit: A process that has been released by OS either after normal termination or after abnormal termination (error). 2/28/2025 cse321-spring2014

  17. State Transition Diagram Pag e 17 Dispatch Release Admit RUNNING EXIT READY NEW Time-out Event Wait Event Occurs BLOCKED Think of the conditions under which state transitions may take place. 2/28/2025 cse321-spring2014

  18. Process creation - Example Pag e 18 main () { int pid; cout << just one process so far <<endl; pid = fork(); if (pid == 0) cout << I am the child << endl; else if (pid > 0) cout << I am the parent << endl; else cout << fork failed << endl;} 2/28/2025 cse321-spring2014

  19. System Calls For Process Management and File Management 19 2/28/2025 cse321-spring2014

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#