Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session 5 Report #31

Open
22 tasks
mousavi2003 opened this issue Jul 29, 2024 · 0 comments
Open
22 tasks

Session 5 Report #31

mousavi2003 opened this issue Jul 29, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@mousavi2003
Copy link

mousavi2003 commented Jul 29, 2024

Team Name: [FILL HERE]

Student Name of member 1: Seyyedeh Fatemeh Mousavi
Student No. of member 1: 400105252

Student Name of member 2: [FILL HERE]
Student No. of member 2: [FILL HERE]

Student Name of member 3: [FILL HERE]
Student No. of member 3: [FILL HERE]

  • Read Session Contents.

Section 5.3.1

  • Write the Hello World! program

    • FILL HERE with your source code
  • Write the ls to wc program

    • FILL HERE with your source code
  • Investigate how to have a bi-direction pipe

    • FILL HERE with your descriptions

Section 5.3.2

  • Describe the usecase of different signals:

    1. SIGINT: SIGINT is the signal sent when we press Ctrl+C. The default action is to terminate the process. However, some programs override this action and handle it differently. One common example is the bash interpreter. When we press Ctrl+C it doesn't quit, instead, it prints a new and empty prompt line.
    2. SIGHUP: SIGHUP ("signal hang up") is a signal sent to a process when its controlling terminal is closed. It was originally designed to notify the process of a serial line drop. The SIGHUP (“hang-up”) signal is used to report that the user's terminal is disconnected, perhaps because a network or telephone connection was broken.
    3. SIGSTOP: When you use SIGSTOP to a process, it will pause the process. It will not resume automatically unless you send a SIGCONT signal to it. This is great because it allows you to pause a process without terminating it.
    4. SIGCONT: The SIGCONT signal instructs the operating system to continue (restart) a process previously paused by the SIGSTOP or SIGTSTP signal.
    5. SIGKILL: Using kill command with SIGKILL signal sends a kill signal to end any process immediately when sent with a PID or a processname. It is a forceful way to terminate a or set of processes. This signal cannot be handled (caught), ignored or blocked.

    picture of man 7 signal:

    image

  • Describe SIGALRM

    1. SIGALRM is generated when the timer set by the alarm function goes off. SIGALRM is an asynchronous signal. The SIGALRM signal is raised when a time interval specified in a call to the alarm or alarmd function expires. Because SIGALRM is an asynchronous signal, the SAS/C library discovers the signal only when you call a function, when a function returns, or when you issue a call to sigchk . Generally SIGALRM is used to notify a process that the specified real-time interval has elapsed.
  • Investigate the given code

    1. First, it sets an alarm for 5 seconds, then it prints the message "Looping forever . . .", and then it enters an infinite loop. The line after the while(1) will never be printed because the program is stuck in the infinite loop. After 5 seconds, the program will receive the SIGALRM signal and its execution will be terminated, since no signal handler has been set for it.
    2. image
  • Modify the given program by handling SIGALRM

    1. [FILL HERE with your source code.]
  • Write a program that handles Ctrl + C

    1. [FILL HERE with your source code.]
@mousavi2003 mousavi2003 added the documentation Improvements or additions to documentation label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants