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).

 

 

   

 

 

   

        

   

       

 

 

 

 

                  

转载于:https://www.cnblogs.com/gavinwu/p/3531175.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值