SlideShare a Scribd company logo
1 of 7
© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Timers
2© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What to Expect?
Alarm based Trivial Timer
Interval Timers based on other Signals
3© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Trivial Timer
Based on the alarm signal (SIGALRM)
One Timer per Process
Timer resolution is in seconds
Activated using the alarm() system call
Any subsequent calls to alarm cancels the previous
ones, if not already triggered
Triggered after seconds specified in last alarm() call
SIGALRM handler is the timer handler
One shot behaviour, unless activated again
4© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Other User Space Timers
Based on Interval Timers
Total of three timers possible per Process
ITIMER_REAL (Based on real time) – SIGALRM
ITIMER_VIRTUAL (Based on execution time) – SIGVTALRM
ITIMER_PROF (Based on overall execution time) – SIGPROF
Timer Resolution is in micro seconds
Though expiry may be a little later
Activated using setitimer system call
And can be queried using gettimer system call
Triggered Periodically, every interval, after current value
As specified in the setitimer call
From the call to setitimer
5© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Other User Space Timers ...
POSIX.1-2008 marks the setitimer / getitimer calls
obsolete
Rather recommends the following
timer_settime, timer_gettime
timer_create, timer_delete
timer_getoverrun
With these, many more interval timers could be used
Using signals other than the 3 usual ones
Also including the real-time signals
6© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What all have we learnt?
Alarm based Trivial Timer
Interval Timers based on other Signals
7© 2010-17 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Any Queries?

More Related Content

What's hot

Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
Anil Kumar Pugalia
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
Anil Kumar Pugalia
 

What's hot (20)

Embedded C
Embedded CEmbedded C
Embedded C
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
Kernel Programming
Kernel ProgrammingKernel Programming
Kernel Programming
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
Linux DMA Engine
Linux DMA EngineLinux DMA Engine
Linux DMA Engine
 
Architecture Porting
Architecture PortingArchitecture Porting
Architecture Porting
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Processes
ProcessesProcesses
Processes
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Embedded Storage Management
Embedded Storage ManagementEmbedded Storage Management
Embedded Storage Management
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
System Calls
System CallsSystem Calls
System Calls
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
 
Kernel Timing Management
Kernel Timing ManagementKernel Timing Management
Kernel Timing Management
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Processes
ProcessesProcesses
Processes
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 

Viewers also liked (15)

Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
References
ReferencesReferences
References
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Bootloaders
BootloadersBootloaders
Bootloaders
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Linux File System
Linux File SystemLinux File System
Linux File System
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
File Systems
File SystemsFile Systems
File Systems
 

Similar to Timers (7)

Timers in Unix/Linux
Timers in Unix/LinuxTimers in Unix/Linux
Timers in Unix/Linux
 
Priority Scheduling.pptx
Priority Scheduling.pptxPriority Scheduling.pptx
Priority Scheduling.pptx
 
Unix presentation.pdf
Unix presentation.pdfUnix presentation.pdf
Unix presentation.pdf
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorial
 
AOS Chapter 6 for internal.docx
AOS Chapter 6 for internal.docxAOS Chapter 6 for internal.docx
AOS Chapter 6 for internal.docx
 
EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1
 
Timer and Timers
Timer and TimersTimer and Timers
Timer and Timers
 

More from Anil Kumar Pugalia (9)

File System Modules
File System ModulesFile System Modules
File System Modules
 
System Calls
System CallsSystem Calls
System Calls
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Power of vi
Power of viPower of vi
Power of vi
 
"make" system
"make" system"make" system
"make" system
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
RPM Building
RPM BuildingRPM Building
RPM Building
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Timers

  • 1. © 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Timers
  • 2. 2© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? Alarm based Trivial Timer Interval Timers based on other Signals
  • 3. 3© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Trivial Timer Based on the alarm signal (SIGALRM) One Timer per Process Timer resolution is in seconds Activated using the alarm() system call Any subsequent calls to alarm cancels the previous ones, if not already triggered Triggered after seconds specified in last alarm() call SIGALRM handler is the timer handler One shot behaviour, unless activated again
  • 4. 4© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Other User Space Timers Based on Interval Timers Total of three timers possible per Process ITIMER_REAL (Based on real time) – SIGALRM ITIMER_VIRTUAL (Based on execution time) – SIGVTALRM ITIMER_PROF (Based on overall execution time) – SIGPROF Timer Resolution is in micro seconds Though expiry may be a little later Activated using setitimer system call And can be queried using gettimer system call Triggered Periodically, every interval, after current value As specified in the setitimer call From the call to setitimer
  • 5. 5© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Other User Space Timers ... POSIX.1-2008 marks the setitimer / getitimer calls obsolete Rather recommends the following timer_settime, timer_gettime timer_create, timer_delete timer_getoverrun With these, many more interval timers could be used Using signals other than the 3 usual ones Also including the real-time signals
  • 6. 6© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What all have we learnt? Alarm based Trivial Timer Interval Timers based on other Signals
  • 7. 7© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?