CSE 220: Systems Programming - Input and Output

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/37

flashcard set

Earn XP

Description and Tags

These flashcards cover critical concepts related to input and output in systems programming, focusing on Unix I/O and Standard I/O as discussed in the lecture.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

38 Terms

1
New cards

File Descriptor

A small integer representing an open file in a particular process.

2
New cards

Kernel System Calls

Low-level functions that provide access to operating system services.

3
New cards

Standard Input

The file descriptor that refers to standard input (usually keyboard input).

4
New cards

Standard Output

The file descriptor that refers to standard output (usually display screen output).

5
New cards

Standard Error

The file descriptor that refers to standard error output.

6
New cards

Open Flags

Parameters that control the behavior of the open() function.

7
New cards

O_RDONLY

Open file for reading only.

8
New cards

O_WRONLY

Open file for writing only.

9
New cards

O_RDWR

Open file for reading and writing.

10
New cards

O_CREAT

Create a file if it doesn’t exist when opening.

11
New cards

O_EXCL

fail if the file already exists when creating a file.

12
New cards

O_APPEND

Start writing at the end of the file.

13
New cards

O_TRUNC

Truncate the file to zero length when opening.

14
New cards

O_CLOEXEC

Close this file descriptor on exec.

15
New cards

/dev/null

A special file that discards all data written to it.

16
New cards

/dev/urandom

A special file that provides cryptographically secure random data.

17
New cards

read()

A system call that reads data from an open file, returning the number of bytes read.

18
New cards

write()

A system call that writes data to an open file, returning the number of bytes written.

19
New cards

close()

A system call that closes an open file descriptor.

20
New cards

fopen()

A standard I/O function that opens a file stream.

21
New cards

fdopen()

Associates a file descriptor with a stream.

22
New cards

fread()

Reads binary data from a stream.

23
New cards

fwrite()

Writes binary data to a stream.

24
New cards

feof()

Checks if the end of file has been reached, returning non-zero if true.

25
New cards

ferror()

Checks if an error has occurred on a stream, returning non-zero if an error exists.

26
New cards

clearerr()

Resets the error and EOF indicators for a stream.

27
New cards

Buffering

A method used to improve performance by temporarily storing data in memory.

28
New cards

fflush()

Flushes the output buffer of a stream, ensuring all data is outputted.

29
New cards

Buffer Flushing

Process of writing data from the buffer to the file.

30
New cards

errno

A global variable set to indicate the error state for system calls.

31
New cards

perror()

Produces a human-readable error message based on errno.

32
New cards

strerror()

Returns a pointer to the textual representation of the current errno.

33
New cards

POSIX

A family of standards specified by the IEEE for maintaining compatibility between operating systems.

34
New cards

C Standard

A standard that describes the programming language C.

35
New cards

Atomic Action

An operation that completes in a single step relative to other operations.

36
New cards

Buffer Example

A method of reading data where larger chunks are read into memory for future access.

37
New cards

System Call Overhead

The time and resources consumed when making a system call.

38
New cards

Unix I/O vs Standard I/O

Unix I/O is low-level and uses file descriptors, while Standard I/O is higher-level and uses streams.