資訊工程學系(Department of Computer Science and Information Engineering)
課程名稱(英文)
Systems Programming
課程代碼
4102150_01
授課教師:
Pao-Ann Hsiung
學分數
3
必/選修
選修
開課年級
2
先修科目或先備能力:
計算機概論、資料結構、程式設計
Introduction to Computer Science, Data Structures, Program Design
課程概述:
To learn advanced programming techniques in a UNIX-like system such as Linux, FreeBSD, MacOS-X, Solaris, which are not addressed by the theoretical coverage in an operating system introductory course, but are required by the practical coverage in an OS design course.
學習目標:
1. Design and implement programs that make efficient use of hardware resources.
2. Design and implement programs that make efficient use of OS services.
3. Design and implement programs that can communicate with each other.
4. Avoid programming flaws in programs with shared data or functions.
5. Create efficient and correct programs.
教科書:
W. Richard Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment, 3rd Edition, Addison Wesley, 2013.
課程大綱
分配時數
核心能力
備註
單元主題
內容綱要
講授
示範
隨堂作業
其他
UNIX System Overview
To give an overview of the UNIX programming environment
1. Logging in
2. Files and directories
3. Input and output
4. Standard I/O
5. Programs and processes
6. Process control
7. ANSI C
8. Error handling
9. User identification
10. Signals
11. UNIX time values
12. System calls and library functions
4
1.11.21.32.12.22.33.13.23.34.14.2
Students are encouraged to install a Linux system and learn how to administrate one. The LAB will allow students to familiarize themselves with Linux.
File I/O
To demonstrate how unbuffered I/O can be used to read/write files.
1. Five functions of unbuffered I/O
2. I/O efficiency vs. buffer size
3. File sharing
4. Atomic operations
5. File and I/O control
5
3
1.11.21.32.12.22.33.13.23.34.14.2
The students need to perform experiments for evaluating the performance of programs with different I/O buffer sizes.
Files and Directories
To present the basics and intricacies of how to access files in a program
1. Filesystem Introduction
2. File types
3. File access permissions
4. Ownerships of files/directories
5. Sticky bit
6. Holes in a file
7. File truncation
8. Symbolic links
9. File times
10. Reading directories
4
1.11.21.32.12.22.33.13.23.34.14.2
The students need to manipulate files, directories, etc. based on the LAB requirements.
Standard I/O Library
To demonstrate how to use standard I/O library functions efficiently
1. Streams
2. Buffering
3. Opening, reading/writing streams
4. Standard I/O efficiency
5. Formatted I/O
6. Temporary files
5
3
1.11.21.32.12.22.33.13.23.34.14.2
This unit emphasizes how standard I/O buffers can be used for program efficiency.
System Data Files and Information
To show the basics of how accounts and data are managed in a UNIX system
1. System files
2. Passwords
3. Groups
4. Login accounting
5. Time and date routines
1
1.11.21.32.12.22.33.13.23.34.14.2
(Self-Reading Chapter)
Process Environment
To explain the environment in which a UNIX process executes
1. Process entry and exit
2. Environment list
3. Memory layout of a C program
4. Shared libraries
5. Memory allocation
6. Jump functions
7. Automatic, register, volatile variables
8. Resource limits
6
1.11.21.32.12.22.33.13.23.34.14.2
This unit makes several process concepts to be learnt in an OS course more concrete and practical. The LAB will focus on setjmp/longjmp APIs.
Process Control
To demonstrate how processes can be controlled during execution
1. Process identifiers
2. Parent and child processes
3. File sharing
4. Child termination
5. Race conditions
6. Exec functions
7. IDs and set ID functions
8. Program times
6
3
1.11.21.32.12.22.33.13.23.34.14.2
This LAB will allow students to familiarize with Race Conditions in programs.
Signals
To demonstrate how to use signals to accomplish interprocess communication
1. Signal concepts
2. Signal generation
3. Signal disposition
4. UNIX signals
5. Unreliable signals
6. Interrupted system calls
7. Reentrant functions
8. kill, raise, alarm functions
9. Signal set
10. Other signal control functions
6
3
1.11.21.32.12.22.33.13.23.34.14.2
This LAB will focus on two concepts: reentrancy and the sigsuspend API.
Interprocess Communication
To introduce the different communication mechanisms available in a UNIX system
1. Pipes
2. FIFOs
3. System V IPC
4. Message queues
5. Semaphores
6. Shared memory
1.1.具有資訊工程相關基礎知識之吸收與了解的能力(Capability to grasp foundational knowledge in computer science.)
1.2.具有運用資訊工程理論及應用知識,分析與解決相關問題的能力(Capability to use computer science theory and application knowledge to analyze and solve related problems.)
1.3.在資訊工程的許多領域中,具有至少某一項專業能力,例如:硬體、軟體、多媒體、系統、網路、理論等(Professional in at least one area, including hardware, software, multimedia, system, networking, and theory.)
2.1.具有資訊工程實作技術及使用計算機輔助工具的能力(Capability to perform computer science implementations and use computer-aided tools.)
2.2.具有設計資訊系統、元件或製程的能力(Capability to design computer systems, components, or processes.)
2.3.具有科技寫作與簡報的能力。(Capability to write and present technical materials.)
3.1.具有除了已有的應用領域之外,亦可以將自己的專業知識應用於新的領域或跨多重領域,進行研發或創新的能力。(Capability to apply one’s professional knowledge to a new application domain or across multiple different application domains.)
3.2.具有領導或參與一個團隊完成一項專案任務的能力並且具有溝通、協調與團隊合作的能力。(Capability to lead or participate in group projects, with effective communication, coordination, and teamwork.)
3.3.具有因應資訊科技快速變遷之能力,培養自我持續學習之能力。(Capability to adapt to rapidly changing computer science technology and to develop self-learning capabilities.)
4.1.具有社會責任、人文素養及奉獻精神。(The awareness of social responsibilities, humanity, and contribution.)
4.2.具有工程倫理、宏觀能力、國際觀及前瞻視野。(The awareness of engineering ethics, broad capabilities, and global and contemporary vision.)
具有資訊工程相關基礎知識之吸收與了解的能力(Capability to grasp foundational knowledge in computer science.)
為何有關:
System programming and administration is a basic skill that each computer scientist should have and this course is a very good practical experience for interested students since he/she must be able to administrate a new system from scratch.
達成指標:
This is a mandatory course and the knowledge attained in this course is required for further studies in this department.
具有運用資訊工程理論及應用知識,分析與解決相關問題的能力(Capability to use computer science theory and application knowledge to analyze and solve related problems.)
為何有關:
This course supplements the OS course with more practical experience with real operating systems and applies several theories from not only OS, but also from data structures, algorithms, and computer architecture. The application of the theories is evident from the performance evaluation of buffering techniques, network programming techniques that are elaborated in class.
達成指標:
(a) Can distinguish between programs that are time-consuming and those that are not. (b) Can analyze system programs.
在資訊工程的許多領域中,具有至少某一項專業能力,例如:硬體、軟體、多媒體、系統、網路、理論等(Professional in at least one area, including hardware, software, multimedia, system, networking, and theory.)
為何有關:
This course enhances a student’s software programming capabilities, with the aim of making him/her into an expert with programming and software skills. At the end of the course, a student acquires knowledge and experience in software programming that largely surpasses a non-computer science student with basic programming skills.
達成指標:
This course is related to system design and thus a student taking this course can learn about system in an efficient and systematic manner.
具有資訊工程實作技術及使用計算機輔助工具的能力(Capability to perform computer science implementations and use computer-aided tools.)
為何有關:
There are five program assignments and a term project, which collectively account for 40% of the course grade. All the five program assignments build up a student’s programming capabilities and are all practical applications of the lectures given in class. The term project is also a greater application of these class lectures and also an opportunity to use various programming and debugging tools and integrated environments.
達成指標:
Can implement programs that are efficient in resource usage. Can use system programming tools to analyze programs and systems.