DV1460 / DV1492:

Realtime- (and) Operating-Systems

13:15-15:00 Thursday October 20th, 2016

Exam Revision

Table of Contents
A slightly cynical guide

1. Exam Preparation

  • Some courses will end with a simple summary of the previous contents.
    • This is a bit redundant as students can (and should) reread the slides.
  • Instead let us spend lecture today actually preparing for the exam.
    • The simplest way to know what to expect in an exam... is to write a few.
    • Unfortunately we do not have the time to give you a few years of teaching experience.
    • But what we can do is give you a quick view of what the examiner is trying to do.
    • If you understand the process, you will find the exam easier to study for.
    • We can mix this up with some exam study techniques.
  • Use the past papers to illustrate this explanation.
    • [...cue Rocky theme music for incoming exam montage...]

2. Step one: Examination Criteria

  • All the examination criteria are listed on the kursplan (5. Mål).
    • There are no "hidden" or "surprise" criteria.
    • But if something is unexplained, it is as if it is "hiding in plain sight".
  • Demonstrate knowledge and understanding by
    • Describing the components in an OS and how they work.
    • Describing the methods and algorithms for sharing resources.
    • Explain problems and solutions with processes/threads in:
      • Communication, Resource sharing, Synchronisation
    • Explain issues arising in realtime communication with external devices:
      • Communication, Timing, Synchronisation
    • Describe security aspects.
  • Compare / Contrast different solutions to issues in OS design.
  • There is lots of overlap between these points.

3. Step two: check the past papers

  • Next, it is good to get an idea of how these criteria are encoded into questions.
  • There are lots of past papers in It's Learning.
  • Helpfully they always split into (roughly) the same five sections.
    • Note: the point balance drifts back and forth between years.
  • Go through each section across years and split questions into categories.
What does X mean?
Possibly extended by examples or breaking down into parts.
Compare X and Y in property Z?
e.g. FCFS and RR in response time.
Explain / Produce worked example of algorithm or technique.
e.g. the fork() call, a context switch, a scheduling algorithm etc

4. Category: define X questions

  • Not all "define X" questions are stated the same way - but they all depend on remembering the definition of a term.
What is a Process Control Block and what is it used for? (Name examples of information that it includes in your answer). (1pt)
The data-structure that stores information about each process, used to track resource use in the system. Includes owner, open files memory layout, and scheduling inf.
  • Why are you being asked this?
    • Demonstrate understanding of the process concept.
    • What is required to make it work.
    • Contents of the data-structure indicate understanding of how scheduling / memory management relates to processes.
    • How could you have predicted this?

5. Category: define X questions

  • Sometimes we check you remember a definition by making you use it:
In a process with base and limit registers of 1200 and 350 (respectively), which of these addresses are valid accesses: A) 355, B) 1200, C) 1551. (1pt)
A) Invalid B) Valid C) Invalid
  • Why are you being asked this?
    • Demonstrate understanding of the base+limit scheme.
    • What is required to make it work.
    • A more evil examiner (probably me) would have asked you: A) 1199 B) 1200 C) 1550 D) 1551.
    • This actually gives you a hint to the definition, but checks that you know the corner cases.
    • i.e. was it \(\lt\) or \(\leq\)? Why would we use one but not the other (cardinal-vs-ordinal)?

6. Category: define X questions

  • Sometimes definition questions look like comparisons:
Are mutex locks and counting semaphores essentially the same thing? [explain your answer] (1pt)
No, mutex locks are similar to binary semaphore in that they have only two states while counting semaphores take integer values.
  • Why are you being asked this?
    • Three definitions in one question!
    • Two of the terms have similar names and are only separated by a single property (the number of values the semaphore can hold).
    • Understanding the definition in this case involves understanding the related definitions.
    • Does this relate to your technique for studying the material?

7. Category: define X questions

  • Sometimes definition questions span multiple definitions explicitly:
What role is played by device controllers and device drivers in a computer system? (1pt)
Device controllers are pieces of hardware that interface the device specific electronics to the bus. Device drivers are the pieces of software that interact with the controller
  • Why are you being asked this?
    • No formal definition this time: informal concepts introduced in the textbook and lectures.
    • Asking you "what role" encourages to explain what they do.
    • We have not explicitly asked for a comparison / contrast - two independent parts to the answer.
    • Examiner is look for two distinct, non-overlapping answers.

8. Category: define X questions

What four conditions must be met for a deadlock to occur? (4pt)
1. Mutual Exclusion 2. Hold and wait 3. No pre-emption 4. Cycle
  • Why are you being asked this?
    • Understanding why deadlock occurs relates strongly to the four individual conditions that it requires.
    • Rembering the four conditions is a good indicator that you have absorbed understanding of the concept.
    • Or it means that you used a mnemonic device to remember the conditions.
    • Michael Ends His War Never Paying Cavalry.
    • Rote Memorisation is boring, try and avoid it: remember memorable phrases.
    • Converting the mnemonic back to the conditions is easier, after studying the terms you should recall them.

9. Revising Definitions

  • Reading is not an effective way to memorise; writing is effective.
  • 1. Scan a chapter and related materials for defs.
  • 2. Write them down - in your own words
  • 3. Memorise what you have written.
  • Pictures can be easier to remember than words, mnemonics, stories...
  • Use variety in studying.
  • Studying different forms of information, about one topic (i.e. defs in Memory chapter), builds episodic memory.
  • (Obviously) understanding helps recall.
  • Interesting feedback: better recall leads to better understanding.

10. Category: comparison questions

  • Comparison questions test if you have understood the difference between two terms.
  • Sometimes these terms are difficult to define independently: interrelated.
  • It is difficult to answer without defining what the terms mean.
What is the difference between a system program and an application program? Give an example of each type.
A system program is something the machine cannot be used without, e.g. the shell. An application program is something shipped separately to the OS that provides additional functionality, e.g. a paint program.
  • Why are you being asked this?
    • Comparison is being used to check you understand the boundary between the two.

11. Category: comparison questions

  • A more complex example: the tradeoff between design choices.
Compare the performance of three different disk allocation principles of contiguous allocation, linked allocation and indexed allocation for both sequential and random file access.
Sequential access to contiguous allocation is optimal for performance. In both linked and indexed allocation each block may lie in a random position on the disk, sequential access in the file will require random access on the disk. Random access into contiguous allocation and indexed allocation will be similar assuming the index blocks are cached in memory. Random access into linked allocation will produce the worst performance as accessing block n will require n previous blocks to be read in order to chance the pointers.
  • Why are you being asked this?

12. Category: comparison questions

  • The answer was a pretty big wall of text.
  • Checking in-depth understanding of a particular issue on the course.
  • These questions are far fewer in number than the simple definition questions.
  • You do not know in advance which areas will be checked in depth.
  • What is the examiner looking for?
    • Random sample of a piece of detailed knowledge.
    • Used to estimate if you have in-depth detailed knowledge of the course.
    • Telling you which bits we check would bias the sample.
  • So how could you prepare this in advance?

13. Category: comparison questions

  • Flat lists of facts are difficult to absorb / remember.
    • Memory of random data is hard.
    • Patterns are easy.
  • Chunking is the psychological process used in memory.
  • Patterns are similarities or connections between data.
    • For a chess player - patterns of movement, attack, defence on the board.
    • These are mostly spatial (not sequences of moves).
  • For in-depth knowledge on the course do not try to remember lists of facts.
  • Try to remember connections and patterns between them...

14. Category: comparison questions

  • Here is an example of how I would take notes on a particular topic.
  • Notice how messy my organisation is, but how it focuses on patterns.
  • We could give you all of these notes...
  • ...but then you would not remember them.
  • Writing them is the core part of studying.

Break (15mins)





Intermission

15. Category: worked example questions

  • Where the course has covered a particular algorithm we may ask you to demonstrate that you understood how it works.
  • Either by answering questions about a provided example, or given some particular parameters sketching out how the algorithm would proceed.
Example
A system with four real-time processes; each deadline coincides with their period time. Investigate whether these processes are possible to schedule with EDF (Earliest Deadline First)? Show with an illustration ([e.g.] Gantt chart)!
ProcessCPU-time per periodPeriod
A13
B14
C312
D324

16. Category: worked example questions

  • [Sanity check first! Does the schedule fit before we make it?] \(\frac{1}{3} + \frac{1}{4} + \frac{1}{4} + \frac{1}{8} = 96\)%
  • [Sanity check first! Can you remember how to do EDF scheduling?]
  • EDF = Earliest Deadline First
  • Period = implies they are periodic (repeating).
  • 1st step: what do the deadlines look like?

17. Category: worked example questions

  • Basic process - working through steps of the algorithm.
  • Constructing a result, making it legible to the examiner.
  • I've interpreted "Gantt chart" quite liberally.
  • What unstated assumptions have I made about "ties" that I should explain?

18. How can I remember all that?

  • At this point students generally ask something like:
    • But how can we remember all of that for the whole course??!?
    • Isn't that crazy. The course is too big...
  • Very simple answer:
    • You are not supposed to.
  • More complex answer:
    • Split your study time into the most productive use.
    • i.e. try to maximise your expected score.
    • Plan out your time...

19. How to use study time most effectively.

  • [Random advice from someone who took a lot of exams once].
    • Note the distribution of questions (and points) in the past papers.
    • Make sure you memorise all the basic defintions you can find (across the sections you are examined on) - generally there are enough points in these to carry you over the pass mark.
    • Remembering the details and differences will lift you up to a good score.
  • Practice until you comfortable with these parts.
  • Divide how much time / energy / motivation you have left into:
    • Algorithms that were explained during the course.
    • Don't try to memorise them all (unless you can...)
    • Pick a few, concentrate your time on getting the details right.
    • Be lucky.

20. Pre-cram studying

  • Go through each section of the course one at a time:
    • Review (skim): slides, textbook, past paper section(s).
  • Make a list of which terms have been introduced (and what they mean):
  • Make a list of differences / tradeoffs / comparisons between similar things.
  • Make a list of which algorithms have been explained.
  • ...
  • Study.
    • There are no shortcuts for this part*.
    • The exam is a random sampling of your understanding on the day.
  • * Not entirely true: good note-taking through a course.

21. Revision Topics: General Overview

  • [Each of these lists is non-exhaustive - follow the advice in previous slides.]
  • Don't assume all questions will be highly-specialised / in-depth.
  • The first section is normally more general / higher-level "overview type stuff"
    • General structure of an OS.
    • System Calls.

22. Revision Topics: Scheduling and Synchronisation

  • Processes.
  • Threads.
  • Scheduling Algorithms and Queues.
  • Context Switches.
  • Mutexes.
  • Semaphores.
  • Critical Regions.
  • Deadlocks, Livelocks, Race Conditions, Starvation.
  • Classic scheduling/synchronisation problems.
  • Priority Schemes and Priority Inversion.

23. Revision Topics: Storage (memory and files)

  • Logical structure of the file-system.
  • Disk Layout.
  • Page Faults.
  • Page Replacement Algorithms.
  • TLB.

24. Revision Topics: I/O

  • Device controllers.
  • Drivers.
  • Interrupt handlers.
  • DMA.
  • Disk scheduling.
  • Definitions of real-time systems.

25. Revision Topics: Security

  • Access control.
  • Threats.
  • Protection Mechanisms.
  • Security Models.
  • Attack Vectors (type of software exploits).

26. So long, and thanks for all the fish!

  • We reach the end of the lectures for the course.
    • Hopefully there has been some useful material.
    • There should be no "voodoo" left in an OS.
    • You have learned enough that you could sit down and write an OS.
    • Which of course is exactly how Linux started off..
  • Course Evaluations will be appearing, please complete them...
    • Is it worth the effort? (i.e. feedback rates could be higher)
    • Managers make resource allocation decisions rather than teachers.
  • I won't say "lycka till" for the exam - might imply it's all chance.
    • "There is no try, only do"
    • "Wax on, wax off. Don't forget to breathe. Very important."