1 분 소요

Signal

  • There can be hardware interrupts, but software interrupts as well
  • GNU signal can be a great reference.
    • Linux relies on GNU
  • Signal API → type of interrupt, handler
  • Signal1.c
    • function pointer → address of the program
    • handler has no return but one input value; signal input is given
    • Check signal is whether Sigint
    • ctrl + c → now task to the program from the outside
    • It changes the control flow of the operation
  • Signal2.c
    • Alarm signal
    • need to handle regular alarm
    • Timer interrupt occurs by a sec
    • by signaling, preemption happens and context switch as well
  • Pipe1.c
    • Nonzero value → error
    • pipe is a kind of file
      • File is anything that can have stream of information
    • Parent and child has same file description information
    • Pipe works for reading and writing
    • If the value is broken, make to write remaining data (buffer)
    • Writing behavior depends on OS/ return sent value, it is because it has limited space of buffer
    • No more data comes to the pipe
    • 3 is reading pipe, 4 is writing pipe
    • reading happens up to 31 characters
    • Child and parent process
    • Through using file, parent and child process exchange their data
    • It is something shared exclusively
      • Doesn’t have global name to be not interrupted by other processes.
      • For one to one communication
    • Unnamed pipe → use to make communicate
    • multiple process invoked at same time, it is to difficult to clarify sender and messages
      • Synchronization
  • Pipe2.c
    • duplicate operation
    • hello program is loaded
    • standard ouput goes to the pipe
    • Hello is executed, sent to the pipe and show up at the display
    • invoke the program at the middle of the program
    • Library → popen (read how to utilizte the API)
      • File is pipe
      • execution results is given to file actually

태그:

카테고리:

업데이트: