Skip to content

System programming in Linux. A program illustrating the use of signals and interval timers to measure the execution time of a process in terms of Real, Virtual and Profiling time using the corresponding timers, as well as implementing the SIGUSR1 and SIGUSR2 signals.

Notifications You must be signed in to change notification settings

MoniqueAxt/lab3_sigs_timers

Repository files navigation

Laboration 3

Compiling & Running

make commands

make / make all

make clean

Command-line args

run

Default task (io) executed if no args provided.

lab3 lab3 io lab3 cpu lab3 cpu-io

Environment & Tools

A vagrant virtual-box running Ubuntu was used to compile and run the code using a Makefile while remaining on the Windows host machine.

IDE: Intellij Clion 2020.2.4

OS: Windows 10 Ubuntu 18.04

Compiler: g++ clang

Tools: Vagrant 2.2.10 Virtual Box 6.1

Purpose

A program illustrating the use of signals and interval timers to measure the execution time of a process in terms of Real, Virtual and Profiling time using the corresponding timers, as well as implementing the SIGUSR1 and SIGUSR2 signals.

Procedures

  • A sigaction structure is set up with a signal handler to handle signals SIGUSR1, SIGUSR2, SIGALRM, SIGVTALM and SIGPROF.
  • The timers are then set up with a itimerval structure with an expiration time of 5 seconds.
  • The appropriate task is then started (determined by command-line argument).
  • Finally, a signal handler manages the signals generated by the timers using getitimer to calculate elapsed real, virtual and profiling times of the process.

Timer comparison

Running the different types of tasks should produce different values for each of the timers.

Real time remains the same as this measures wall-clock time. Virtual time indicates only the time used by the process. Profiling time indicates virtual time plus time spend in systems calls for the process.

Thus, CPU-intensive tasks will result in higher virtual time, while I/O-heavy tasks should result in a higher prof time. A combination of both CPU- and I/O-heavy tasks means both virtual and profiling time will be higher.

About

System programming in Linux. A program illustrating the use of signals and interval timers to measure the execution time of a process in terms of Real, Virtual and Profiling time using the corresponding timers, as well as implementing the SIGUSR1 and SIGUSR2 signals.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published