Software Designer (Operating System)

operating system

  • computer system

    • Consists of hardware and software
    • Computer System Hierarchy
      • Computer hardware (system software developers) bare metal
      • Operating system (system software developer)
        • The first expansion of hardware, editors, assemblers, compilers, and database management systems are all based on the operating system
      • System software (application software developers)
      • application
      • end user
  • Process management (processor management)

    • Process is the basic unit of resource allocation and independent operation
    • In multi-program batch processing and time-sharing systems, there are multiple concurrently executing programs. In order to describe the dynamic process of program execution in the system, process is introduced.
    • Precursor graph (sequential execution)
      • A directed acyclic graph, X->YX is the predecessor of Y, Y is the successor of X, and Y can only be executed after X is executed
      • The main characteristics of sequential program execution include sequentiality, closure, and reproducibility
      • X--------->YX ends V(s1) operation Y starts P(s1) operation semaphore initial value 0
    • Precursor graph (parallel execution)
      • Lost program closure
      • There is no longer a one-to-one correspondence between programs and machine execution activities
      • Mutual constraints between concurrent programs
    • five state model
      Please add a picture description
  • interprocess communication

    • Synchronization and Mutex
      • Synchronization is a direct constraint problem between cooperative processes, and mutual exclusion is an indirect constraint problem between processes that apply for critical resources
      • Principles of Critical Section Management
        • Advance if available, wait if not available, limited waiting, give up the right to wait
      • Value range: number of available resources X process N -(NX)`X
    • deadlock
      • Improper allocation of similar resources causes deadlock. m resources of the system are shared by n processes. When each process requires k resources, m<nk may cause deadlock. m=>n(k-1)+1 will not deadlock
      • Deadlock prevention: ostrich strategy (ignore strategy), prevention strategy, avoidance strategy√, detection and contact strategy
    • Process Resource Map
      • Process P->Resource R applies for resources and in turn allocates resources
      • The allocation is in the application first, the application is just to judge that it will not go away, if there is a non-blocking, you can try to simplify
    • thread
      • Attribute: (process) an independent unit that can own resources, (thread) a basic unit that can be independently scheduled and allocated
      • A thread is an entity in a process that can share all resources owned by the process with other threads belonging to the same process. (Processes can be shared by threads, threads cannot be shared with threads)
  • Principle of program locality

    • time constraints
      • Once a certain instruction in the program is executed, it will be executed again soon, and the storage unit is accessed, but it is not being accessed. The typical reason for the time limitation is that there are a large number of loop operations in the program.
    • Space limitations
      • Once a program accesses a certain storage unit, nearby storage units are most likely to be accessed in the near future, that is, the addresses accessed by the program within a certain period of time are concentrated in a certain range. The typical reason is that the program is executed sequentially.
    • Elimination principle
      • If the status bit is 1, it means that it can only be eliminated in the memory; when the access bit is 0, it will be eliminated first;
  • Paging storage management

    • (Logical address) address structure (16 bits) page number 4+ page address 12 (page size 4k=4096=2 to the 12th power)
  • Segmented paging storage management

    • Address structure (32 bits): segment number (up to x segments) + page number within the segment (maximum allowed x pages) + address within the page (page size x)
  • single buffer

    • Time: (T+M)*n+CT input M transmission C processing n number
  • double buffer

    • Time: T*n+M+C premise M+C<T
  • Disk Scheduling Algorithm

    • First-come-first-served (FCFS) The total absolute value of head movement in sequence adds up to the average seek length/number of sequences
    • Shortest seek first (SSTF) according to the shortest distance to the head
    • Elevator scheduling or scanning (SCAN) first select one direction until there is no more to change to another direction
    • Cyclic scanning (CSCAN) or one-way scanning, first select one direction to dry until it is gone, change to another direction and start
  • Rotation Scheduling Algorithm

    • Normal time: read processing time of the first record + {(rotation speed-processing time)+read processing time}*(n-1)
  • multi-level index structure

    • The address item points to the disk data block. The maximum file length needs * disk index block size
      • direct address index
        • point directly to the disk data block
      • Level 1 Indirect Address Index
        • First point to the disk index block (first-level index 1KB), which contains an address item (4B) address item (as a direct address index) pointing to the position of the last block of the disk data block (1KB) +255
      • Secondary indirect address index
        • It first points to the disk index block (secondary index 1KB) and contains address items (4B). Each address item (direct address index) points to the disk index block (first-level index 1KB) and finally points to the last block position of the disk data block +256²-1
  • File Directory

    • Composed of file control blocks (file directory entries), it is specially used for file retrieval.
      • Including at least the file name and the physical address where the file is stored is called the file control block (FCB)
      • Basic information, access control information, usage information
    • If the system crashes when writing the modification result of the directory file back to the disk, the impact on the system will be relatively large
  • Directory Structure

    • multi-level directory structure
      • Inverted rooted tree, each node is a directory, and the leaf nodes are files
      • Each directory uses \ to splice the full file name. Everything must be an absolute path. The last file name does not need to write \ to end the relative path (the path of the relative position, the current working directory \ can not be written). The last file name does not need to write \ to end...\upper level directory.\current directory (can be omitted)
  • bitmap

    • Use a binary bit to represent the usage of a physical block
    • The font size starts from 0, and the physical block number starts from 0. 1 byte is equal to 32 bits disk capacity (*1024)/disk size/word length = x words
    • The size of the bitmap is determined by the size of the disk space (total number of physical blocks)
  • expand

    • The issues that need to be considered in the design of the operating system are: the management of the hardware resources of the computer system, the management of the software resources in the computer system, and the interface between the user and the computer.
    • The main task of system-level initialization is software initialization, mainly for the initialization of the operating system.
    • Embedded system initialization process: chip level -> board level -> system level initialization
    • What image files to use file associations to open
    • When the user's keyboard or mouse enters an application system, the first thing to get information is the interrupt processing
    • I/O device level: user process, device-independent system software, device driver, interrupt handler, hardware

Guess you like

Origin blog.csdn.net/weixin_45113182/article/details/128679225