Untitled - Share ITS

Transcription

Untitled - Share ITS
2 . PROCESS
Operating System Concepts with Java – 8th Edition
Silberschatz, Galvin and Gagn
SPOILER
http://io9.com/if-your-brain-were-a-computer-howmuch-storage-space-w-509687776
2.5 petabytes ~ record 3 million hours of TV shows
operating system - process
3
operating system - process
4
WHAT ?
Process is a
program
in execution
process execution must progress in sequential fashion
„a process includes:
1.
program counter
2. stack
3. data section
Process in Memory
operating system - process
5
Process State (important)
As a process executes, it changes state
New
: The process is being created
Running
Waiting
occur
: Instructions are being executed
: The process is waiting for some event to
Ready
: The process is waiting to be assigned to a
processor
Terminated
operating system - process
: The process has finished execution
6
Diagram of Process State
operating system - process
7
Process State (important)
As a process executes, it changes state
New
: The process is being created
Running
Waiting
occur
: Instructions are being executed
: The process is waiting for some event to
Ready
: The process is waiting to be assigned to a
processor
Terminated
operating system - process
: The process has finished execution
8
Process Control Block (PCB)
Information associated with each process
X Process state
X Program counter
X CPU registers
X CPU scheduling information
X Memory-management information
X Accounting information
X I/O status information
Where is it ?
operating system - process
9
CPU Switch From Process to Process
operating system - process
10
Process Scheduling Queues
X Job queue– set of all processes in the system
X Ready queue – set of all processes residing in main
memory, ready and waiting to execute
X Device queues – set of processes waiting for an I/O
device
Processes migrate among the various queues
operating system - process
11
Representation of Process Scheduling
operating system - process
12
Schedulers
Long-term scheduler
x
(or job scheduler) –
selects which processes should be brought into the
ready queue
X
Short-term scheduler
(or CPU scheduler) –
selects which process should be executed next and
allocates CPU
operating system - process
13
Addition of Medium Term Scheduling
operating system - process
14
Scheduler
Short-term
scheduler is invoked very
(milliseconds) -> (must be fast)
frequently
Long-term
scheduler is invoked very infrequently
(seconds, minutes) -> (may be slow)
The long-term scheduler controls the degree of
multiprogramming
Processes can be described as either:
X I/O-bound process– spends more time doing I/O
than computations, (many & short CPU bursts)
X CPU-bound process– spends more time doing
computations; (few & very long CPU bursts)
operating system - process
15
Context Switch (important)
When CPU switches to another process, the system
must save the state of the old process and load
the saved state for the new process
Context of a process represented in the PCB
Context-switch time is overhead; the system does
no useful work while switching
Time dependent on hardware support
operating system - process
16
Process Creation
Parent process create children processes, which, in turn create
other processes, forming a tree of processes
Process identified and managed by a process identifier (pid)
In Resource sharing
X Parent and children share all resources
x Children share subset of parent’s resources
x Parent and child share no resources
In Execution
In Address space
X Child duplicate of parent
x Child has a program loaded into it
X Parent and children execute concurrently
X Parent waits until children terminate
operating system - process
17
Process Creation (cont)
UNIX examples (UNIX ????)
X fork system call creates new process
X exec system call used after a fork to replace the
process’ memory space with a new program
operating system - process
18
A tree of processes on a typical Solaris
operating system - process
19
Process Termination
Process executes last statement and asks the OS to delete
it (exit)
X Output data from child to parent
X Process’ resources are deallocated by OS
Parent may terminate execution of children processes (abort)
x Child has exceeded allocated resources
x Task assigned to child is no longer required
x parent is exiting
Some operating system do not allow child to continue if
its parent terminates
All children terminated - cascading termination
operating system - process
20
Interprocess Communication
Processes may be independent or cooperating (Can
affect or be affected by other processes, including
sharing data)
Why cooperating ?
Information sharing , Computation speedup ,
Modularity, and Convenience
Two models of IPC :
Shared memory & Message passing
operating system - process
21
IPC model
Which one is message passing ?
Which one is Shared memory ?
operating system - process
22
Synchronization in Message Passing
„
Blocking as a synchronous
Blocking send, the sender block until the message
is received
Blocking receive, the receiver block until a message
is available
Non-blocking as a asynchronous
Non-blocking send, the sender send the message
and continue
Non-blocking receive, the receiver receive a valid
message or null
operating system - process
23
1.
Communications in Client-Server Systems
Sockets
2. Remote Procedure
Calls,
3. R
„ emote Method
Invocation (Java)
A socket is Concatenation
of IP address and port
as an endpoint for
communication
e.g. socket 161.25.19.8:1625
host 161.25.19.8
port 1625
„Communication consists
between a pair of
sockets
operating system - process
24
The END . . .
References
1. Abraham Silberschatz, Peter Baer Galvin, Greg
Gagne, Operating System Concepts With Java, Wiley
operating system - process
26
Assignment 2A
Make report about your experiment in dual boot
x Experiment 1 - Windows Linux x
1. Explain detail steps to install windows and then linux on the
same machine/pc
2. Explain about GRUB, or LILO according to the installation
x Experiment 2 - Linux windows x
1. Explain detail steps to install linux and then windows on the
same machine/pc
2. Is there any difference installation steps between 1st
experiment and 2nd
3. How about the GRUB or LILO, is it all right ? or anything is
missing ? Explain how to overcome the missing thing (if there is
something wrong)
operating system - process
27
Assignment 2B
Please record your both of your experiments, upload
your video (less than 45 minutes) that contain
essential/important part of your experiments on
youtube. So may be this will be your first video
tutorial. Submit it's link before due date
Score level from lowest to highest :
1. just plain video tutorial
2. video tutorial with subtitle or narration
3. video tutorial with English subtitle or English narration
4. point number 4 plus interesting things like you add
background sound, or embedding video capturing
yourself explain experiments, (like this
http://www.youtube.com/watch?v=_ BXML7n1R-0 , I am
sure you can make better than that) or other
creative tutorial that make youtube downloader
entertained
operating system - process
28
SUBMISSION
Submit your report to elearning
REPORT must contain :
1.
Cover page : Student id, and bla bla bla, and
youtube link (please put the link on cover page)
2. Explanation important step of those experiments
3. References
Format : AS2-< NRP> .pdf (eg. AS2-5213100010.pdf)
operating system - process
29
Class Assignment
Each student Write on paper instructions (in bahasa
indonesia) about :
a. How to cook (team 1, team 5)
b. How to remove stubborn dirt (dish) (team 2, team
6)
c. How to bathing baby (team 3, team 7)
d. How to repair vehicle (team 4, team 8)
Write the steps separated with line, not paragraph
Count the words and put It on right top corner of
your paper page
operating system - process
30