zoukankan      html  css  js  c++  java
  • Chapter 1 Unix System Overview 1

    1.  Operating system: Provide services for programs they run.

            Typical services: (1) excuting a new program.

                                    (2) opening a file, reading a file.

                                    (3) allocating a region of memory.

                                    (4) getting the current time of day   and so on.

    2. Unix Architecture

        (1). Operating system in a strict sense (The kernel):

              1) controls the hardware resources of the computer.

              2) provides an enviroment under which programs can run.

        Figure 1.1

       System calls: the interface to the kernel.

       Shell: a specical application  that provides an interface for running other applications.

        (2). Operating system in a broad sense:

            1) kernel;

            2) all the other software.

    3. Logging In

        (1) Loggin name

            1) password file: /etc/passwd.

            2) entry in the password file: seven colon-separated fields:

                login name; encrypted password; numeric user ID(205); numeric group ID(105); comment filed; home directory; shell program;

                sar:x:205:105:Stephen Rago:/home/sar:/bin/ksh

                encrypted password file to a different file. Chapter 6.

        (2) Shell: a command-line interpreter that reads user input and excutes commands.

    4. Files and Directories

        (1) Unix File system: a hierarchical arrangement of directories and files.

            1) Directory:  a file that contains directory entries.

                    A directory entry: contains a filename along with a structure of information describing the attributes of the file.

                    Attributes of the file:  a) type of file - regular file.

                                                    b) directory - the size of file.

                                                    c) the owner of the file.

                                                    d) permissions for the file.

                                                    e) when the file was last modified.

                The attributes in greate detail in chapter 4.

                Make a distinction between the logical view of a directory entry and the way it is actually stored on disk. Clear when discussing hard links in chapter 4.

        (2) Filename

             The names in a directory are called filenames. (slash  / and null).

        (3) Pathname

            Absolute pathname;

            Relative pathname;

        (4) Working Directory

            (1) used by the process: from which relative pathnames are interpreted.

            (2) use chdir function to change working directory.

        (5) Home Directory

        (1) log in, password file.

    5: Input and Output

        (1) File Descriptors

            1) small non-negative integers

            2) used by the kernel to identify files.

            3) a particular process.

        (2) Standard Input, Standard Output, Standard Error.

            1) when a new program is run , shells open three descriptors: standard input, standard output, standard error (connected to the terminal).

            2) shells provide a way to redirect the descriptors to any file.

        (3) Unbufferd I/O functions

            1) open, read, write, lseek and close.

            2) functions all work with file descriptors.

             in chapter 3, we describe the unbuffered I/O functions in more detail.

        (4) Standard I/O

            1) provide a buffered interface to the unbuffered I/O functions.

            2) using Standard I/O prevents us from having to worry about choosing optimal buffer sizes, such as BUFFSIZE constand.

            3)simplify dealing with lines of input (a common occurence in UNIX  applications).   fgets,  reads an entire line.

            4) <stdio.h> contains the function prototypes for all the standard I/0 functions.

    6. Programs and Processes

        (1) Program

            1) an executable file residing on disk in a directory.

            2) It is read into memory and is executed by the kernel as a result of one of the six excec functions.   (Section 8.10)

        (2) Processes and Process ID

            1) Process : an excecuting  instance of a program.

            2) Process ID :every process has a unique numeric identifier  (a non-negative integer).

        (3) Process Control

             Three main functions for process control: fork, exec, waitpid  (exec function has six variants, but we often refer to them collectively as simply the exec function).

       

       

            

       

           

                      

  • 相关阅读:
    c# 调用CMD窗口执行命令
    WPF 添加阴影效果
    WPF中鼠标拖动窗体
    c# exe程序只让启动一个
    $.when().done().then()的用法
    Math.round(),Math.ceil(),Math.floor()取整计算
    面向对象的程序设计-继承
    MATLAB | 直接保存窗口图片而不弹出figure窗口
    MATLAB 小tips总结
    图像数字处理 | Bit-Plane Slicing 比特平面分层- 如何计算
  • 原文地址:https://www.cnblogs.com/gavinwu/p/3531175.html
Copyright © 2011-2022 走看看