2019-2020-1 20175320 "Information Security System Design Basics" eighth week of learning summary
First, the learning content summary
For this week for the system-level I / O way, mainly for a variety of applications called I / O functions were understood, the following is a summary of the contents of this week:
System unified I / O
- Open the file function
int open(char *filename, int flags, mode_t mode)
, which is the process of operational behaviors to flag the file, mode for the access permission bits. The function returns a file descriptor - Function closes the file
int close(int fd);
- Function to read the file
ssize_t Read(int fd, void *buf, size_t count);
- Function to write files
ssize_t Write(int fd, const void *buf, size_t count);
- Unbuffered read
ssize_t rio_readn(int fd, void *usrbuf, size_t n); ssize_t rio_writen(int fd, void *usrbuf, size_t n);
- Write buffered
ssize_t rio_readnb(rio_t *rp, void *usrbuf, size_t n); ssize_t rio_readlineb(rio_t *rp, void *usrbuf, size_t maxlen);
, wherein the buffered row is read from rio_readlineb and rio_readnb additive used, but with the buffer and the buffer can not function without the use of intersecting with the buffer must be based on a function ofrio_read
the function - Function to read file information
int stat(const char *filename, struct stat *buf); int fstat(int fd, struct stat *buf);
- Read the contents of a directory function
DIR *opendir(const char*name);
andstruct dirent *readdir(DIR *dirp);
in which actual use requires repeated calls readdir function
Use of man and grep tool
Here I use the read function as an example.
1, using the man -k read | grep 2
command to view the read system call.
2, using the man -k read | grep 2 | grep file
command to further refine the range based on 1.
3, using the grep -nr xxx /usr/include
command to view the macro definitions, wherein n represents the line number, r represents recursion. Below to view the macro definition of MAXLINE keyword.
Second, the problem of teaching and learning in the process of resolving
This week content for coding practices, textbooks no problems were encountered.
Third, the problem of debugging the code and resolution
Problem 1: Problem teaching operation code appears as shown in Figure 1 when.
Problem 1 Solution: finding is not correct to add header files, operating normally after adding headers.
Question 2: Exercise 10.1 output is -1, and unrealistic.
Question 2 Solution: There is no need to create a file code, create operating normally after file.
Question 3: The following compilation error occurs after exercise 10.3:
Question 3 Solution: The man 2 wait
required header file, add operating normally find.
Attach practice run 5 results:
Fourth, code hosting
V. Other (perception, thinking, etc., optional)
This week the contents of system-level I / O, by this chapter I make my system based / O functions with understanding, which helps independent system functions, and so that I had at the time could not use the standard library functions accordingly solution.
Six, learning progress bar
Blog amount (add / accumulate) | Learning time (add / accumulate) | Important growth | |
---|---|---|---|
aims | 30 | 400 hours | |
The third week | 1/1 | 13/13 | |
the fourth week | 1/2 | 22/35 | |
fifth week | 1/3 | 30/65 | |
Sixth Week | 1/4 | 25/90 | |
Week Seven | 1/5 | 22/112 | |
Eighth Week | 1/6 | 25/137 |
Try recording "planned learning time" and "actual learning time" to the end see if you can improve their ability to plan. This study is very important work, is also useful. Consuming an estimated equation: Y = X + X / N, Y = XX / N, training more often, X, Y will close.
Reference: Why is estimated that software engineering software so hard , software engineering estimation method
- Plan study time: XX hours
- The actual study time: XX hours
- Improvements:
(Available see more modern software engineering courseware software engineers the ability to self-evaluation form )