Chapter 1 : Linux System Programs FAQs

Expert Level 1 : Introduction

  1. Components of linux system

  2. System calls

Expert Level 2 : File management

  1. File I/O system calls

  2. Synchrone File I/O: sync(), fsync(), fdatasync()

  3. Positional Reads and Writes: pread(), pwrite()

  4. Truncating files: truncate(), ftruncate()

  5. Multiplexed I/O: select(), poll()

  6. Program to open existing file for reading

  7. Program to create an empty file for writing using open system call

  8. Program to read 10 bytes from an existing non empty file

  9. Program to read all the bytes from an existing non empty file

  10. Program to create an empty file for writing using creat system call

  11. Program to write a string into an empty file

  12. Program to append a string into existing file

  13. Program to show the usecase of sync()

  14. Program to show use case of fsync()

  15. Program to show use case of fdatasync()

  16. Program to read nth byte of a file and copy it to another file using lseek

  17. Program to write a string into a file using pwrite and read the file using pread

  18. Program to truncate a file

Expert Level 3 : Process Management

  1. Signals

  2. signals: signal system call

  3. signals: sigaction system call

  4. signals: kill system call

  5. signals: raise system call

  6. signals: pause system call

  7. signals: alarm system call

  8. Mapping signal Numbers to Strings: psignal(), strsignal()

  9. signals: killpg system call

  10. Process

  11. Different process states

  12. Process: fork system call

  13. Process: exec system call

  14. Process: exit system call

  15. Process: abort system call

  16. Process: assert system call

  17. Process: wait, waitpid system call

  18. Process: getpid, getppid

  19. Threads

  20. Posix threads

  21. pthread: pthread_create

  22. pthread: pthread_exit

  23. pthread: pthread_join

  24. pthread: pthread_self

  25. pthread: pthread_equal

  26. pthread: pthread_cancel

  27. pthread: pthread_detach

  28. system calls to get, set time

  29. sleep, usleep, nanosleep system calls

  30. Interval timers

  31. Posix timer: timer_create

  32. Posix timer: timer_settime, timer_gettime

  33. Posix_timer: timer_getoverrun

  34. Posix timer: timer_delete

  35. Program to print a string infinite times and terminate if user press ctrl+c

  36. Program to illustrate user-defined Signal Handler

  37. Program to setup a simple signal handler using sigaction

  38. Program to register a signal handler for SIGINT that simply prints a message and then terminates the program (Use pause())

  39. Program to map signal numbres to string using sys_siglist

  40. Program to send SIGUSR1 to current process using raise ssysytem call

  41. Program which traps all the signals (that can be trapped) and displays a suitable message when any signal is received by the process.

  42. Program which reads and displays characters typed at the keyboard. Set up an alarm which will print a message if no characters are typed within a short space of time.

  43. Program to send SIGKILL signals to all of your running processes except your current process

  44. Program to register the same handler for SIGTERM and SIGINT, reset the behavior for SIGPROF to the default and ignore SIGHUP.

  45. Program to create a child process and print whether the process is child or parent.

  46. Program to create a child process and print pid of parent and child process.

  47. Program to print current time of the day

Expert Level 4 : System V IPC

  1. IPC mechanism

  2. Pipes and FIFOs

  3. Pipe: pipe system call

  4. Pipe: popen, pclose

  5. FiFO: mkfifo

  6. IPC mechanism: system V message queues

  7. IPC mechanism: shared memory

Expert Level 5 : System V Synchronization

Expert Level 6 : POSIX IPC

  1. Posix message queues

  2. Posix message queue: mq_open

  3. Posix message queue: mq_close

  4. Posix message queue: mq_unlink

  5. Posix message queue: mq_getattr, mq_setattr

  6. Posix message queue: mq_send

  7. Posix message queue: mq_receive

  8. Posix message queue: mq_notify

  9. Posix shared memory

Expert Level 7 : POSIX Synchronization

Expert Level 8 : Networking

  1. Implement a TCP IPv4 server and client to exchange continuous data; A chat box.

    socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

  2. Implement a UDP IPv4 server and client to exchange continuous data; A chat box.

    socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

  3. Implement a TCP IPv6 server and client to exchange continuous data; A chat box.

    socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);

  4. Implement a UDP IPv6 server and client to exchange continuous data; A chat box.

    socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);

  5. Implement a Raw TCP IPv4 server and client to exchange continuous data; A chat box.

    socket(PF_INET, SOCK_RAW, IPPROTO_TCP);

  6. Implement a Raw UDP IPv4 server and client to exchange continuous data; A chat box.

    socket(PF_INET, SOCK_RAW, IPPROTO_UDP);

  7. Implement a Raw TCP IPv6 server and client to exchange continuous data; A chat box.

    socket(AF_INET6, SOCK_RAW, IPPROTO_TCP);

  8. Implement a Raw UDP IPv6 server and client to exchange continuous data; A chat box.

    socket(AF_INET6, SOCK_RAW, IPPROTO_UDP);