• Change of Process State
  • UNIX Process State
  • User Credentials
  • The u Area
  • Unix foundations




    Download 1.51 Mb.
    bet3/9
    Sana19.05.2023
    Hajmi1.51 Mb.
    #61987
    1   2   3   4   5   6   7   8   9
    Bog'liq
    process

    When to Switch a Process

    • Interrupts
      • Clock
        • process has executed for the maximum allowable time slice
      • I/O
    • Memory fault
      • memory address is in virtual memory so it must be brought into main memory
    • Trap
      • error occurred
      • may cause process to be moved to Exit state
    • Supervisor call

    Change of Process State

    • Save context of processor including program counter and other registers
    • Update the process control block with the new state and any accounting information
    • Move process control block to appropriate queue - ready, blocked
    • Select another process for execution
    • Update the process control block of the process selected
    • Update memory-management data structures
    • Restore context of the selected process

    UNIX Process State

    • Initial (idle)
    • Ready to run
    • Kernel/User running
    • Zombie
    • Asleep
    • for 4BSD: stopped/suspend

    Process states and state transitions

    Process Context

    • User address space:
      • code, data, stack, shared memory regions,
    • Control information:
      • u area, proc, kernel stack, ATM
    • Credentials: UID & GID
    • Environment variables:
      • inherited from the parent
    • Hardware context(in PCB of u area):
      • PC, SP, PSW, MMR, FPU

    User Credentials

    • Superuser: UID=0, GID=1
    • Real IDs: log in, send signals
    • Effective IDs: file creation and access
    • exec:
      • suid mode: that of the owner;
      • sgid mode: that of the calling process
    • setuid / setgid:
    • SV & BSD are different with these
      • saved UID, saved GID in SV
      • setgroup in BSD

    The u Area

    • part of the process space, needed only when running.
      • PCB
      • proc pointer
      • UID s
      • Arguments, results, error status from system calls
      • Signal handlers and related information
      • Info from the program header, text, data, stack size, MM info
      • Open file descriptor
      • Vnodes & controlling terminal pointers
      • CPU usage statistics, profiling info, disk quotas, & resource limits
      • Per-process kernel stack

    Download 1.51 Mb.
    1   2   3   4   5   6   7   8   9




    Download 1.51 Mb.