National Instruments Interview Question for Software Engineer / Developers
- 1of 1 vote
AnswersDesign a One shot timer library capable of supporting multiple times simultaneously. Cancel is also supported. Only ONE hardware timer register.So basically, a process/function can call SetTime(10) and it will get notified after 10 seconds. It can also say SetTime(2)... SetTime(7). Then it will get two notifications, one after 2 and one after 7. [SetTime returns a handle]
- SG October 15, 2008
The process(s) can also issue a cancel. Cancel(handle), to cancel a specific timer they set.
The hardware timer registers, assume decrements by 1 every 1 second. So if you set it to 10, it will notify you after 10 seconds. Basically it interrupts, and lets say calls RegExpired(). You can Read/Write this register anytime very fast (uS).
The key here how you make use of this single register to support any number of timer events that applications/processes are demanding asynchronously.
Discuss the data structure you would use and implement it in C.| Report Duplicate | Flag | PURGE
National Instruments Software Engineer / Developer Coding