Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Lecture Operating systems: Lesson 10 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: input, output, and error redirection in UNIX/Linux; FIFOs in UNIX/Linux; use of FIFOs in a program and at the command line; . | Operating Systems Lecture 10 Agenda for Today Review of previous lecture Input output and error redirection in UNIX Linux FIFOs in UNIX Linux Use of FIFOs in a program and at the command line Recap of lecture Review of Lecture 9 UNIX Linux IPC tools and associated system calls UNIX Linux standard files and kernel s mechanism for file access Use of pipe in a program and at the command line Input Output Error Redirection You can use the Linux redirection features to detach the default files from stdin stdout and stderr and attach other files with them. Input Redirection Input Redirection command lt input-file command 0 lt input-file Purpose Detach keyboard from stdin and attach input-file to it i.e. command reads input from input-file and not keyboard Input Redirection cat lt Phones contents of Phones grep Nauman lt Phones output of grep Output Redirection Output Redirection command gt output-file command 1 gt output-file Purpose Detach the display screen from stdout and attach output-file to it i.e. command sends output to output-file and not the display screen Output Redirection cat gt Phones your input grep Ali Phones gt Ali.phones output of grep find -name foo -print gt foo.log error messages Error Redirection Error Redirection command 2 gt error-file Purpose Detach the display screen from stderr and attach error- file to it i.e. error messages are sent to error-file and not the display screen Error Redirection find -name foo -print 2 gt errors output of the find command ls -l foo 2 gt error.log output of the find command cat error.log ls foo No such file or directory find -name ls -print 2 gt dev null bin ls UNIX Linux FIFOs IPC for communication between related or unrelated processes on a computer P1 P2 FIFO UNIX Linux System UNIX Linux FIFOs A file type in UNIX Created with mknod or mkfifo system call or by mkfifo command UNIX Linux FIFOs Unlike a pipe a FIFO must be opened before using it for communication A write to a FIFO that no process has opened for .