Passing of Parameters As A Table - PowerPoint PPT Presentation

1 / 81
About This Presentation
Title:

Passing of Parameters As A Table

Description:

managing the system's resources (the communication between hardware and software ... Process creation, deletion, suspension and resumption. Provision of ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 82
Provided by: CNS2
Category:

less

Transcript and Presenter's Notes

Title: Passing of Parameters As A Table


1
Passing of Parameters As A Table
2
System Call Memory Map
3
Types of System Calls
  • Process control
  • File management
  • Device management
  • Information maintenance
  • Communications

4
Types of System Calls
  • Process control
  • Call Description
  • pidfork() Create a child process
    identical to parent
  • pidwaitpid(pid, statloc, options) Wait for
    child to terminate
  • sexecve(name, argv, environp) Replace a
    process core image
  • exit(status) Terminate proc execution
    return status

5
Types of System Calls
  • File Management
  • Call Description
  • fdopen(file, .) Open file for read,
    write, or both
  • sclose(fd) Close an open file
  • nread(fd, buf, nbytes) Read
    data from file to buffer
  • nwrite(fd, buf, nbytes) Write
    data from buffer to file
  • poslseek(fd, offset, whence) Move
    file pointer to .
  • sstat(name, buf) Write data
    from buffer to file

6
Types of System Calls
  • Directory and File System Management
  • Call Description
  • smkdir(name, mode) Create a new
    directory
  • srmdir(name, mode) Remove an empty
    directory
  • slink(name1, name2) Create new
    entry name2, pointing to name1
  • sunlink(name)
    Remove a directory entry
  • smount(special, name, flag) Mount a
    file system
  • sumount(special)
    Unmount a file system

7
UNIX vs Win System Calls
  • UNIX
  • - One-to-one relationship between system calls
    (e.g., read)
  • and library procedures (e.g., read) to invoke
    system calls.
  • i.e., for each syscall ? roughly one library
    procedure that is
  • called to execute it.
  • Windows
  • - radically different.
  • - library calls and syscalls are highly
    decoupled.
  • - Win32 API defined for programmers to use to
    get OS services.
  • - Supported on all versions of Windows since
    Win95.
  • - Difficult to distinguish kernel syscall and
    user(-space) library
  • calls

8
UNIX vs Win System Calls
9
MS-DOS Execution
At System Start-up
Running a Program
10
UNIX Running Multiple Programs
11
Communication Models
  • Communication may take place using either message
    passing or shared memory.

Shared Memory
Msg Passing
12
System Programs
  • provide a convenient environment for program
    development and execution. The can be divided
    into
  • File manipulation
  • Status information
  • File modification
  • Programming language support
  • Program loading and execution
  • Communications
  • Application programs
  • Most users view of the operation system is
    defined by system programs, not the actual system
    calls.

13
MS-DOS System Structure
  • MS-DOS written to provide the most
    functionality in the least space
  • not divided into modules
  • Although MS-DOS has some structure, its
    interfaces and levels of functionality are not
    well-separated

14
MS-DOS Layer Structure
15
UNIX System Structure
  • UNIX
  • limited by hardware functionality
  • - the original UNIX operating system had
    limited
  • structuring.
  • - the UNIX OS consists of two separable parts.
  • ? Systems programs

16
UNIX System Structure
  • ? The kernel
  • Consists of everything below the system-call
    interface and above the physical hardware
  • Provides the file system, CPU scheduling, memory
    management, and other operating-system functions
    a large number of functions for one level.

17
UNIX System Structure
18
Layered Approach
  • the OS is divided into a number of layers
    (levels), each built on top of lower layers.
  • - the bottom layer (layer 0) is the hardware
  • - the highest (layer N) is the user interface.
  • With modularity, layers are selected such that
    each uses functions (operations) and services of
    only lower-level layers.

19
An Operating System Layer
20
OS/2 Layer Structure
21
Microkernel System Structure
  • Moves as much from the kernel into user space.
  • Communication takes place between user modules
    using message passing.
  • Benefits
  • - easier to extend a microkernel
  • - easier to port the operating system to new
    architectures
  • - more reliable (less code is running in kernel
    mode)
  • - more secure

22
Windows NT Client-Server Structure
23
Virtual Machines
  • A virtual machine takes the layered approach to
    its logical conclusion.
  • It treats hardware and the operating system
    kernel as though they were all hardware.
  • It provides an interface identical to the
    underlying bare hardware.
  • The OS creates the illusion of multiple
    processes, each executing on its own processor
    with its own (virtual) memory.

24
Virtual Machines (Cont.)
  • The resources of the physical computer are shared
    to create the virtual machines.
  • CPU scheduling can create the appearance that
    users have their own processor.
  • Spooling and a file system can provide virtual
    card readers and virtual line printers.
  • A normal user time-sharing terminal serves as the
    virtual machine operators console.

25
System Models
Non-virtual Machine
Virtual Machine
26
VM Advantages/Disadvantages
  • provides complete protection of system resources
    since each VM is isolated from all other VMs.
  • ? isolation permits no direct sharing of
    resources.
  • perfect vehicle for OS RD. System development
    is done on the VM, instead of on a physical
    machine
  • ? does not disrupt normal system operation.

27
VM Advantages/Disadvantages
  • VM concept is difficult to implement due to the
    effort required to provide an exact duplicate to
    the underlying machine.

28
Java Virtual Machine
  • Compiled Java programs are platform-neutral
    bytecodes executed by a Java Virtual Machine
    (JVM).
  • JVM consists of
  • - class loader
  • - class verifier
  • - runtime interpreter
  • Just-In-Time (JIT) compilers increase performance

29
Java Virtual Machine
30
System Design Goals
  • User goals
  • OS should be convenient to use, easy to
  • learn, reliable, safe, and fast.
  • System goals
  • OS should be easy to design, implement, and
  • maintain, as well as flexible, reliable,
    error-
  • free, and efficient.

31
Mechanisms and Policies
  • Mechanisms determine how to do something,
    policies decide what will be done.
  • The separation of policy from mechanism is a very
    important principle
  • ? allows maximum flexibility if policy
  • decisions are to be changed later.

32
System Implementation
  • Traditionally written in assembly language.
  • OS can now be written in higher-level languages.
  • Code written in a high-level language
  • can be written faster.
  • is more compact.
  • is easier to understand and debug.
  • An operating system is far easier to port (move
    to some other hardware) if it is written in a
    high-level language.

33
System Generation (SYSGEN)
  • OSs are designed to run on any of a class of
    machines ? system must be configured for each
    specific computer
  • site.
  • SYSGEN program obtains information concerning the
    specific configuration of the hardware system.
  • Booting starting a computer by loading the
    kernel.
  • Bootstrap program code stored in ROM that is
    able to locate the kernel, load it into memory,
    and start its execution.

34
Units - Orders of Magnitude
  • kilo (103) milli (10-3)
  • mega (106) micro (10-6)
  • giga (109) nano (10-9)
  • tera (1012) pico (10-12)
  • peta (1015) femto (10-15)
  • exa (1018) atto (10-18)

35
Units - Orders of Magnitude
36
Units - Orders of Magnitude
37
Units - Orders of Magnitude
38
Processes
  • Process Concept
  • Process Scheduling
  • Operations on Processes
  • Cooperating Processes
  • Interprocess Communication
  • Communication in Client-Server Systems

39
Process Concept
  • An OS executes a variety of programs
  • Batch system jobs
  • Time-shared systems user programs or tasks
  • Terms job and process interchangeably.
  • Process a program in execution process
    execution must progress in sequential fashion.
  • A process includes
  • program counter
  • stack
  • data section

40
Process State
  • As a process executes, it changes state
  • new The process is being created.
  • running Instructions are being executed.
  • waiting The process is waiting for some event
    to occur.
  • ready The process is waiting to be assigned to
    a CPU.
  • terminated The process has finished execution.

41
Diagram of Process State
42
Process Control Block (PCB)
  • Information associated with each process.
  • Process state
  • Program counter
  • CPU registers
  • CPU scheduling information
  • Memory-management information
  • Accounting information
  • I/O status information

43
Process Control Block (PCB)
44
CPU Switch From Process to Process
45
Process Scheduling Queues
  • Job queue
  • set of all processes in the system.
  • Ready queue
  • set of all processes residing in main memory,
  • ready and waiting to execute.
  • Device queues
  • set of processes waiting for an I/O device.
  • Process migration between the various queues.

46
Ready Various I/O Device Queues
47
Process Scheduling
48
Schedulers
  • Long-term scheduler (or job scheduler)
  • selects which processes should be brought
  • into the ready queue.
  • Short-term scheduler (or CPU scheduler)
  • selects which process should be executed
  • next and allocates CPU.

49
Addition of Medium Term Scheduling
50
Schedulers (Cont.)
  • Short-term scheduler is invoked frequently (ms)
  • ? (must be fast).
  • Long-term scheduler is invoked infrequently
    (seconds, minutes)
  • ? (may be slow).

51
Schedulers (Cont.)
  • The long-term scheduler controls the degree of
    multiprogramming.
  • Processes can be described as either
  • ?I/O-bound process
  • spends more time doing I/O than computations,
  • many short CPU bursts.
  • ? CPU-bound process
  • spends more time doing computations few very
  • long CPU bursts.

52
Context Switch
  • When CPU switches to another process
  • - must save the state of the old process
  • - load the saved state for the new process.
  • Context-switch time is overhead the system does
    no useful work while switching.
  • Time dependent on hardware support.

53
Process Creation
  • Parent process create children processes, which,
    in turn create other processes, forming a tree of
    processes.
  • Resource sharing
  • Parent and children share all resources.
  • Children share subset of parents resources.
  • Parent and child share no resources.
  • Execution
  • Parent and children execute concurrently.
  • Parent waits until children terminate.

54
Process Creation (Cont.)
  • 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.

55
Processes Tree on UNIX
56
Process Termination
  • Process executes last statement and asks the
  • to decide it (exit).
  • Output data from child to parent (via wait).
  • Process resources are deallocated by operating
    system.

57
Process Termination
  • Parent may terminate execution of children
  • processes (abort).
  • Child has exceeded allocated resources.
  • Task assigned to child is no longer required.
  • Parent is exiting.
  • OS does not allow child to continue if its parent
    terminates.
  • Cascading termination.

58
Cooperating Processes
  • Independent process cannot affect or be affected
    by the execution of another process.
  • Cooperating process can affect or be affected by
    the execution of another process
  • Advantages of process cooperation
  • Information sharing
  • Computation speed-up
  • Modularity
  • Convenience

59
Producer-Consumer Problem
  • Paradigm for cooperating processes
  • - producer process produces information
  • - consumed by a consumer process.
  • Cases
  • unbounded-buffer places no practical limit on the
    size of the buffer.
  • bounded-buffer assumes that there is a fixed
    buffer size.

60
Bounded-Buffer Shared-Memory Solution
  • Shared data
  • define BUFFER_SIZE 10
  • Typedef struct
  • . . .
  • item
  • item bufferBUFFER_SIZE
  • int in 0
  • int out 0
  • Solution is correct, but can only use
    BUFFER_SIZE-1 elements

61
Bounded-Buffer Producer Process
  • item nextProduced
  • while (1)
  • while (((in 1) BUFFER_SIZE) out) / do
    nothing /
  • bufferin nextProduced
  • in (in 1) BUFFER_SIZE

62
Bounded-Buffer Consumer Process
  • item nextConsumed
  • while (1)
  • while (in out) / do nothing /
  • nextConsumed bufferout
  • out (out 1) BUFFER_SIZE

63
Interprocess Communication (IPC)
  • Mechanism for processes to communicate and to
    synchronize their actions.
  • Message system
  • processes communicate with each other
  • without resorting to shared variables.
  • IPC facility provides two operations
  • send(message) message size fixed or variable
  • receive(message)

64
Interprocess Communication (IPC)
  • If P and Q wish to communicate, they need to
  • establish a communication link between them
  • exchange messages via send/receive
  • Implementation of communication link
  • physical (e.g., shared memory, hardware bus)
  • logical (e.g., logical properties)

65
Implementation Questions
  • How are links established?
  • Can a link be associated with more than two
    processes?
  • How many links can there be between every pair of
    communicating processes?
  • What is the capacity of a link?
  • Is the size of a message that the link can
    accommodate fixed or variable?
  • Is a link unidirectional or bi-directional?

66
Direct Communication
  • Processes must name each other explicitly
  • send (P, message) send a message to process P
  • receive(Q, message) receive a message from
    process Q
  • Properties of communication link
  • Links are established automatically.
  • A link is associated with exactly one pair of
    communicating processes.
  • Between each pair there exists exactly one link.
  • The link may be unidirectional, but is usually
    bi-directional.

67
Indirect Communication
  • Messages are directed and received from mailboxes
    (also referred to as ports).
  • Each mailbox has a unique id.
  • Processes can communicate only if they share a
    mailbox.

68
Indirect Communication
  • Properties of communication link
  • Link established only if processes share a common
    mailbox
  • A link may be associated with many processes.
  • Each pair of processes may share several
    communication links.
  • Link may be unidirectional or bi-directional.

69
Indirect Communication
  • Operations
  • create a new mailbox
  • send and receive messages through mailbox
  • destroy a mailbox
  • Primitives are defined as
  • send(A, message)
  • send a message to mailbox A
  • receive(A, message)
  • receive a message from mailbox A

70
Indirect Communication
  • Mailbox sharing
  • P1, P2, and P3 share mailbox A.
  • P1, sends P2 and P3 receive.
  • Who gets the message?
  • Solutions
  • Allow a link to be associated with at most two
    processes.
  • Allow only one process at a time to execute a
    receive operation.
  • Allow the system to select arbitrarily the
    receiver. Sender is notified who the receiver
    was.

71
Synchronization
  • Message passing may be either blocking or
    non-blocking.
  • Blocking is considered synchronous
  • Non-blocking is considered asynchronous
  • send and receive primitives may be either
    blocking or non-blocking.

72
Buffering
  • Queue of messages attached to the link
    implemented in one of three ways.
  • 1. Zero capacity 0 messagesSender must wait
    for receiver (rendezvous).
  • 2. Bounded capacity finite length of n
    messagesSender must wait if link full.
  • 3. Unbounded capacity infinite length Sender
    never waits.

73
Client-Server Communication
  • Sockets
  • Remote Procedure Calls
  • Remote Method Invocation (Java)

74
Sockets
  • A socket is defined as an endpoint for
    communication.
  • Concatenation of IP address and port
  • The socket 161.25.19.81625 refers to port 1625
    on host 161.25.19.8
  • Communication consists between a pair of sockets.

75
Socket Communication
76
Remote Procedure Calls (RPC)
  • RPC abstracts procedure calls between processes
    on networked systems.
  • Stubs client-side proxy for the actual
    procedure on the server.
  • The client-side stub locates the server and
    marshalls the parameters.
  • The server-side stub receives this message,
    unpacks the marshalled parameters, and performs
    the procedure on the server.

77
Marshalling Parameters
78
Execution of RPC
79
Remote Method Invocation (RMI)
  • Remote Method Invocation (RMI) is a Java
    mechanism similar to RPCs.
  • RMI allows a Java program on one machine to
    invoke a method on a remote object.

80
Sought-out Specialties 2004
Specialty of 1400 CIOs surveyed Application
development 18 Networking 13 Help
desk 12 Internet development 9 DB
management 8 Project management
8 Info security 7
81
High-Demand Skills
Skills Windows
Administration 82 SQL Server Admin 56 CISCO
Network admin 38 VB development 37 Check
Point Firewall admin 32 ASP development
27 XML development 19 Linux
admin 16 Java development 15 .Net
development 14 Oracle development 13 Active X
development 11
Write a Comment
User Comments (0)
About PowerShow.com