日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

APUE学习笔记之UNIX系统概述(1)

發(fā)布時間:2025/5/22 windows 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 APUE学习笔记之UNIX系统概述(1) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

  APUE 全稱: Advanced Programming in the Unix Environment.

  參考書籍為人民郵電出版社出版的Advanced Programming in the Unix Environment英文版第二版,筆記先列英文原文,下面是自己翻譯版,由于英文水平問題,錯誤的地方還望大家指正,自己的總結(jié)就沒有英文原版拉。

  1 UNIX System Overview (Unix 系統(tǒng)概述)

  1.1 Introduction (介紹)

  All operationg systems provide services for programs they run. (所有的操作系統(tǒng)為它們所允許的程序提供服務(wù)。)

  1.2 UNIX Architecture (Unix 架構(gòu))

  In a strict sence, an operating system can be defined as the software that controls the hardware resources of the computer and provides an environment under which programs can run. (嚴(yán)格來說,操作系統(tǒng)被定義為控制計算機(jī)的硬件資源的軟件和為程序提供允許的環(huán)境。)

  In a borad sense, an operating system is the kernel and all the other software that makes a computer useful and gives the computer its personality.(寬泛的說, 操作系統(tǒng)是“核心” 和其它一些軟件,它們使得計算機(jī)非常有用的和個性話的。)

  1.3 Logging in (登錄)

  Login name (登錄名)

  The /etc/passwd file:

???????  

  yanjf: the login name (登錄名:?惟一; 大小寫是敏感; “*” 表示該賬號被查封了,系統(tǒng)不允許持有該賬號的用戶登錄)

  x: encrypted password (加密密碼:用一個“x”來代替,將/etc /shadow作為真正的口令文件)

  1000:?numeric user ID (用戶ID:數(shù)值;在某些特定目的下,系統(tǒng)中可以存在多個擁有不同注冊名、但UID相同的用戶,事實上,這些用戶是同一個用戶)

  1000: numeric group ID (用戶組ID:數(shù)值;每個用戶可以同時屬于多個組;在/etc/group文件中指明一個組所包含用戶)

  yanjf,,,: a command field (注釋字段:包含有關(guān)用戶的一些信息,如用戶的真實姓名、辦公室地址、聯(lián)系電話,mail和finger等程序利用這些信息來標(biāo)識系統(tǒng)的用戶)

  /home/yanjf: home directory (主目錄:超級用戶root的主目錄為/root;而其它個人用戶在/home目錄下均有自己獨立的工作環(huán)境)

  /bin/bash: shell program (默認(rèn)shell腳本)

  Shells

  A shell is a command-line interpreter that read users input and executes commands.(shell 是一個命令行解釋器,它讀取用戶輸入并且執(zhí)行命令。)

NamePath
Bourne shell /bin/sh
Bourne-again shell/bin/bash
C shell/bin/csh
Korn shell/bin/ksh
TENEX C shell/bin/tcsh

  1.4 Files and Directories (文件和目錄)

  File System (文件系統(tǒng))

  The UNIX file system is a hierarchical arrangement of directories and files. (UNIX 文件系統(tǒng)是按層次組織的目錄和文件。)

  A directory is a file that contains directory entries. (目錄是一個包含目錄條目的文件。)

  We can think of each directory entry as containing a filename along with a structure of information describing the attributes of the file.(我們可以認(rèn)為每個目錄條目是包含一個文件名和一個描述文件屬性的結(jié)構(gòu)體。)

  Filename

  The names in a directory are called filenames. (目錄下的名稱稱為文件名。)

  The only two characters that cannot appear in a filenames are the slash character(/) and the null character. (只有 “/” 和 null 不能出現(xiàn)在文件名中。)

  / 分隔路徑中的文件名。null 終止路徑。

  Two filenames are automatically created whenever a new directory is created: . and .. 。Dot refers to the current directory, and dot-dot refers to the parent directory.(新建目錄是自動創(chuàng)建 "."? 和 ".." 兩個文件名。“.”指向當(dāng)前目錄,“..”指向父目錄)

  In the root directory , dot-dot is the same as dot. (在根目錄下,"." 和 “..” 指向同一個目錄。)

  Today, almost all commercial UNIX file system support at least 255-character filenames. (當(dāng)今,幾乎所有的商用Unix文件系統(tǒng)都支持至少255個字符的文件名。)

  Pathname (路徑名)

  A sequence of one or more filenames, separated by slashes and optionally starting with a slash, forms a pathname. (由/開頭或者由/分隔的文件名組成路徑。)

  A pathname that begins with a slash is called an absolute pathname; otherwise, it's called a relative pathname. (/開頭的路徑稱為絕對路徑,否則為相對路徑。)

  Working Directory (工作目錄)

  Every process has a working directory, sometimes called the current working directory. (每個進(jìn)程都有一個工作目錄,有時稱為當(dāng)前工作目錄。)

  Home Directory (主目錄)

  When we log in, the working direcotry is set to our home directory. (登錄后工作目錄默認(rèn)為我們的主目錄。)

  1.5 Input and Output (輸入和輸出)

  File Descriptors (文件描述符)

  Standard Input, Standard Output, and Standard Error (標(biāo)準(zhǔn)輸入,標(biāo)準(zhǔn)輸出,標(biāo)準(zhǔn)錯誤輸出)

  Redirected (>) (重定向) : ls > file.list

  Unbuffered I/O (無緩沖 I/O)

  Unbuffered I/O is provided by the functions open, read, write, lseek, and close.

  Standard I/O (標(biāo)準(zhǔn) I/O)

  The standard I/O functions provides a buffered interface to the unbuffered I/O functions. (標(biāo)準(zhǔn)I/O函數(shù)為無緩沖I/O函數(shù)提供拉一個緩沖接口。)

  1.6 Programs and Processes (程序和進(jìn)程)

  Program (程序)

  A programs is an executable file residing on disk in a directory. (程序是記錄在硬盤上的一個目錄中的可執(zhí)行文件。)

  Processes and Process ID (進(jìn)程和進(jìn)程ID)

  An executing instance of a program is called a process. (一個程序執(zhí)行時的實例稱為進(jìn)程。)

  The UNIX System guarantees that ervery process has a unique numeric identifier called the process ID. (Unix 系統(tǒng)確保每個進(jìn)程有一個唯一的數(shù)值標(biāo)識稱為進(jìn)程ID(非負(fù)整數(shù)).)

  Process Control (進(jìn)程控制)

  There are three primary functions for process control: fork, exec, and waitpid. (三個主要的進(jìn)程控制函數(shù):fork,exec, waitpid。)

  Threads and Thread IDs (線程和線程ID)

  All the threads within a process share the same address space, file descriptors, stacks, and process-related attributes. (所有在同一個進(jìn)程內(nèi)的線程共享相同的地址空間,文件描述符,棧,和進(jìn)程相關(guān)的屬性。)

  1.7 Error Handing (錯誤處理)

  When an error occurs in one of the Unix System functions, a negative value is often returned, and the integer errno is usually set to a value that gives additional information. (當(dāng)Unix系統(tǒng)函數(shù)發(fā)生錯誤時,經(jīng)常會返回一個負(fù)數(shù),同時errno這個整數(shù)會被設(shè)置為一個值,來提供額外的信息。)

  Error Recovery (錯誤恢復(fù))

  A fatal error hao no recovery action. (致命的錯誤沒有恢復(fù)動作。)

  Nonfatal errors, on the other hand, can sometimes bu dealt with more robustly. (另一方面,非致命性的錯誤可以處理的更健壯。)

  1.8 User Identification (用戶標(biāo)識)

  User ID (用戶ID)

  The user ID from our entry in the password file is a numeric value that identifies us to the system. (passwd文件中的用戶ID是一個數(shù)值作為我們的系統(tǒng)標(biāo)識)

  We call the user whose user ID is 0 either root or superuser. (用戶ID為0的稱為root 或者 superuser。)

  Group ID (用戶組ID)

  Our entry in the password file alse specifies our numberic group ID. (我們的passwd文件也指定啦我們的用戶組ID。)

  There is also a group file that maps group names into numeric group IDs. (有一個組文件來匹配組名和用戶組ID。)

  The /etc/group file:

?  

  組名:口令:組標(biāo)識號:組內(nèi)用戶列表

  we call the functions getuid and getgid to return the user ID and the group ID. (我們使用 getuid 和 getgid 函數(shù)返回用戶ID和組ID。)

  1.9 Signals (信號)

  Signals are a technique used to notify a process that some condition has occurred. (信號是一種用來通知進(jìn)程某些條件發(fā)生的技術(shù)。)

  1.10 Time Values (時間值)

  Calendar time: This value counts the number of seconds since the Epoch: 00:00:00 January 1, 1970, Coordinated Universal Time(UTC). timt_t holds these time values.

  Process time: This is also called CPU time and measures the central processor resources used by a process. (測量進(jìn)程所使用的中央處理器資源)clock_t holds these time values.

  Clock time: sometimes called wall clock time is the amount of time the process takes to run. (進(jìn)程允許的時間量。)

  User CPU time: the CPU time attributed to user instructions. (執(zhí)行用戶指令的時間)

  System CPU time: the CPU time attributed to the kernel when it executes on behalf of the process. (進(jìn)程占用內(nèi)核的時間。)

  1.11 System Calls and Library Functions (系統(tǒng)調(diào)用和庫函數(shù))

  All implementations of the UNIX System provide a well-defined, limited number of entry points directly into the kernel called system calls. (Unix 系統(tǒng)的實現(xiàn)都提供一個明確的,有限的指向核心的入口點,稱為”system calls“。)

  The technique used on UNIX systems is for each system call to have a function of the same name in the standard C library. (每個系統(tǒng)調(diào)用在標(biāo)準(zhǔn)C庫函數(shù)有一個同名的函數(shù)。)

  An application can call either a system call or a library routine. Also realize that many library routines invoke a system call. (應(yīng)用程序可以調(diào)用系統(tǒng)調(diào)用和庫例程,另外,許多庫例程調(diào)用啦系統(tǒng)調(diào)用。)

  1.12 Summary (總結(jié))

  This chapter has been a short tour of the UNIX System. (這章簡單的了解拉下Unix系統(tǒng)。)

  The next chapter is about standardization of the UNIX System and the effect of work in this area on current systems. (下章是關(guān)于Unix 系統(tǒng)標(biāo)準(zhǔn)化和當(dāng)前系統(tǒng)在這方面的影響。)  

  (完)

?

轉(zhuǎn)載于:https://www.cnblogs.com/yanjf/p/3321956.html

總結(jié)

以上是生活随笔為你收集整理的APUE学习笔记之UNIX系统概述(1)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。