Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

UTS: ENGINEERING

UTS:ENGINEERING
48450: REAL-TIME OPERATING SYSTEMS
Tutorial Problems POSIX and HRTS
This is a collection of tutorial problems that is directed at the POSIX programming and Hard Real-time Systems topics. The POSIX programming topics are demonstrated in practice by a collection of small programs that you can download from UTSOnline it's recommended that you compile these programs and observe their behaviour before making some modifications of your choosing to them and assessing the results. Please note that it will be slight variations of a subset of these questions that comprise the final examination.

UTS: ENGINEERING

Problems on POSIX programming and Hard Real-time Systems


1. POSIX is an interface specification, rather than in implementation specification explain what this means and then indicate whether you think its true or false (NOTE: a simple true or false response alone, will not be sufficient). 2. What is the principle goal of POSIX? 3. Two of the functions that POSIX offers to deal with run-time compliance checks are sysconf() and pathconf(). Explain the differing purposes of these two functions. 4. #ifdef _POSIX_MAPPED_FILES is an example of (A) compile time checking, or (B) run-time checking? (include your reasoning of course). 5. What is the wait() system call used for? 6. What does fork() achieve? How can this be used in conjunction with exec()? 7. What program attributes can be retained after executing an exec() call? 8. What is errno and how is it used? 9. If a program checks the return value of the fork() system call, and its equal to 0, what does this indicate? 10. Write down two (2) of the more appropriate uses of POSIX.1 signals. 11. Write down three deficiencies of POSIX.1 signals that POSIX.4 attempts to fix. 12. Signals are like a software interrupt explain what this means. 13. What happens when an alarm (set by the alarm() function) goes off? 14. What is a signal handler? Why is it necessary to set one up for each expected signal? 15. What is the kill() function used to do? 16. List three (3) things you can use a signal to achieve that is, three good uses of signals. 17. How do you send a signal to a process? 18. What does sigsuspend() do? 19. What is (most commonly) the result of sending a signal to a process that hasnt been set up explicitly to deal with it? 20. Explain the difference between blocking a signal and ignoring a signal. 21. When a standard UNIX pipe is used to transfer information between a parent and a child process, the pipe must be created before the fork() system call explain why this is the case, and also explain why POSIX FIFOs dont have this requirement. 22. Which two system calls are used to put information into pipes and to read information from them? 23. Can traditional UNIX pipes be used to transfer information between processes that are on different machines in a network? What about named pipes? 24. What extra features do POSIX.4 message queues offer over both pipes and FIFOs? 25. Traditional UNIX pipes require a common process ancestry. POSIX FIFOs however, do not. Why? 26. POSIX.4 offers a memory locking facility under what circumstances might you consider using this? 27. For the two types of semaphores that are available under POSIX.4, explain what mechanisms make the semaphore accessible beyond the scope of the process that create them.

UTS: ENGINEERING

28. POSIX shared memory offers advantages over other communication methods list these and then describe one problematic issue with the use of shared memory. 29. When used on a shared memory region, what does the ftruncate() system call allow you to do? 30. What is mmap() used to achieve? 31. The unlink collection of system calls, unlink(), mq_unlink(), sem_unlink() and shm_unlink() all perform a similar important function what is it? 32. The SCHED_RR and SCHED_FIFO macros ask the scheduler to behave differently, describe the differences between them. 33. Explain in simple terms the relationship between POSIX clocks and POSIX timers. 34. In the context of a priority based scheduability test, the response time for any task is made up of three factors: the execution time for the task, the interference (or preemption) factor and the blocking factor. Explain their meanings on a timing diagram using a simple three task example.
Task 1

Task 2

Task 3

35. What features of an operating system are necessary to support either rate or deadline monotonic scheduling of a task set? 36. A system call is one type of computational overhead that must be accounted for when applying either Rate Monotonic, or Deadline Monotonic analysis. Explain how this overhead can be incorporated into the analyses and compare this with the way interrupts (and interrupt service routines) can also be incorporated. 37. How does Deadline Monotonic analysis differ from Rate Monotonic analysis? 38. What is priority inversion? 39. How can we incorporate the extra overhead of a system call into RMA?

UTS: ENGINEERING

Some formulae to which you may refer, are listed below Lui and Laylands Theorem 1
n i= 1

Ci
i

n( 2

1 n

The imprecise deadline monotonic scheduling test


i : 1 i n :

Ci Di

Ii Di

where
i 1

Ii =

j= 1

Di Cj Tj

The more precise deadline monotonic scheduling test


i : 1 i n :

Ci Di

Ii Di

where
i 1

Ii =

j= 1

[ ] [
Task Type Periodic Aperiodic Aperiodic Periodic Periodic

Di D j Di + 1 Cj + Tj Tj

( )] (
Period (seconds) 1.2 1.5 2.5

D i D j Di + 1 min C j , D i Tj Tj Tj

)]

40. A particular real-time system is to support five independent processes sharing one processor, using the Rate Monotonic scheduling algorithm. The time domain parameters for all five processes are tabulated below:
Task Identifier A B C D E Execution Time(seconds) 0.2 0.3 0.4 0.2 0.3 Response Time (seconds) 2.0 3.0 -

What assumption must be made before Liu and Laylands first theorem can be applied? What justification is there for making this assumption? Is the task set schedulable by Liu and Laylands Theorem 1?

UTS: ENGINEERING

41. Consider the following set of tasks with attributes shown - all time quantities are

measured in milliseconds (msec).


Task A: CA=6, TA=80 Task B: CB=12, TB=90 Task C: CC=15, TC=150 Task D: CD=18, TD=200 Task E: CEI=5, CEA=17, TE=250 Task F: CF=30, aperiodic Periodic process. Periodic process. Interrupt driven, all processing done by interrupt service routine (not premptible). Periodic process. Interrupt driven, with interrupt processing being 5 msec and application processing being 15 msec. The aperiodic events that take 30 msec to process can occur every 300 to 500 msec.

Note: Unless otherwise stated, assume that deadlines are at the end of the period. Also assume that all application level processing is assigned priorities rate monotonically. Use the expanded (extended) scheduability model to determine if each task is scheduable. Use a clear algebraic notation to represent what you are interpreting as preemption factors, the task itself, and blocking factors before 'plugging in' the numbers. 42. Consider the following process system which is based on deadline monotonic scheduling. Note that all time quantities are measured in milliseconds (msec). Task 1: Task 2: Task 3: C1=5, D1=10, T1=25 C2=10, D2=20, T2=30 C3=15, D3=35, T3=50

See if you can determine the scheduability of all the processes using the imprecise test.

UTS: ENGINEERING

43. Consider the following task set, noting that deadlines are again, no longer coincident with periods: Task Identifier Task A Task B Task C C 3 2 4 D 4 8 14 T 5 15 20

A real-time systems designer has already applied the imprecise deadline monotonic scheduling test and discovered that Task C fails that test. Apply the more precise test to Task C alone and see if that helps determine schedulability.

You might also like