Assignment title: Information


EN0572: Operating systems and concurrency Course Work 2014-15 Module tutor: David Kendall 1 Dates and mechanisms for assessment submission and feedback Date of hand out to students: 3rd November 2014 Mechanism to be used to disseminate to students: eLP Date and Time of Submission by Student: • Demonstration: In lab session in w/c 8th December 2014 • Reports: 23.59 on 12th December 2014 Mechanism for Submission of Work by Student: The reports should be submitted via eLP using the Turnitin links as follows: • Software report: Assessment->Software Report. • Theory and concepts report: Assessment->Theory Report. Date by which Work, Feedback and Marks will be returned to Students: Within 3 working weeks of submission date. Mechanism(s) for return of assignment work, feedback and marks to students: eLP + appointment/email. 12 Assignment brief 2.1 Introduction You are required to develop software that uses the uC/OS-II operating system to implement a security briefcase alarm on a LPC-2378STK ARM board. Your software should be written in standard C and should run on an ARM board in PB S2. You should imagine that an LPC2378-STK board could be fixed to a briefcase to act as a security device. The security mechanism is enabled by pressing BUT_1. When enabled, if the device detects any motion of the briefcase, it requires a user to enter a 4 digit security code within some predefined time interval (known as the ALARM_INTERVAL), starting when the motion was first detected. A count of the time remaining should be shown on the display, as should the ALARM_INTERVAL. If the correct code is entered in time, the security mechanism is disabled and the briefcase can be opened by pressing BUT_2 (which is also used to lock the briefcase). If the correct code is not entered in time, the alarm is raised. A typical device, currently available for sale, makes a loud (100 dB) noise as its alarm. In order to avoid disruption to others in the lab, your device should simply flash the LEDs and display an appropriate status message instead. The alarm can be turned off only by entering the correct 4 digit code, following which the security mechanism is disabled. The user should use the joystick to enter the security code: LEFT and RIGHT should be used to cycle round the digits on the display; UP and DOWN should be used to increment/decrement the selected digit. The value of the ALARM_INTERVAL can be adjusted only when the security mechanism is disabled. It should be possible to use the red knob (potentiometer) to select an integer value between 10 and 120 seconds. A typical display may look like this: Alarm : PENDING Interval : 120 Time : 7 Case : LOCKED MOVING Code : 0 0 2 4 - 22.2 Additional requirements You should begin your solution by downloading the file workspace.zip into a suitable directory. Unzip the file and open the workspace workspace.eww. Your software should make use of uC/OS-II and should comprise at least the following tasks: • Three input tasks: 1. buttons and joystick task 2. potentiometer task 3. accelerometer task • Two output tasks: 1. LCD task 2. LED task Each task should be concerned with a single well-defined aspect of the overall program functionality, e.g. the potentiometer task should just read the potentiometer value and adjust the ALARM_INTERVAL, if allowed to do so; it should not manipulate the LCD or the LED directly. That is the job of the output tasks. You MUST use a circular buffer protected by semaphores for all communication between tasks. 3 Systems and Concurrent Programming (50%) 3.1 Software Demonstration You will be required to attend a demonstration in a lab session in week 12. This should be regarded as a formal University examination. Failure to attend will result in a mark of zero for the demonstration. Marks at the demonstration will be awarded as follows: 1. Demonstrated functionality of the program (10 marks) 2. Quality and understanding of code (10 marks) 33.2 Software Report You are required to produce a report on your software addressing the topics below. 1. Design and concurrency (a) Give a brief overview of the design of your program. Pay particular attention to your management of concurrency, e.g. you should address how concurrency is introduced into your program and how interference between tasks is avoided. (5 marks) (b) Explain any specific concurrent programming techniques that you have adopted, e.g. bounded buffer. Illustrate your answer with diagrams, if appropriate. (5 marks) (c) Briefly consider alternative approaches that you could have adopted to the design and implementation of your program and justify your chosen approach. (5 marks) 2. Low-level systems programming (a) Identify in your program two examples of the use of memorymapped I/O. Write out the code for your chosen examples and explain thoroughly how the I/O functionality is achieved in each case. (6 marks) (b) Give examples from your program of event-handling by polling and event-handling by interrupts. Explain clearly the difference between these two approaches to event-handling. Discuss the advantages and disadvantages of each approach. Illustrate your answer with examples. (9 marks) 44 OS theory and concepts (50%) You are required to produce a report addressing the topics below. 1. Process management Describe in detail the actions taken by an operating system to achieve a context switch between processes. Illustrate your answer with diagrams. (10 marks) 2. Security Suppose that the developers of the alarm system decide to add a wireless communication facility to the device so that its status can be monitored remotely or so that its configuration parameters can be modified remotely. Imagine that the function to modify the configuration parameters is implemented as follows: void updateConfigParams ( void ) f char b u f f e r [ 5 1 2 ] ; int i = 0; while (( c = readFromWireless ( ) ) != NULL) f b u f f e r [ i ] = c ; i += 1; g writeConfigParams ( b u f f e r ) ; g where the readFromWireless() function simply reads the next available byte from the wireless device and the writeConfigParams(buffer) function writes data in the buffer to a pre-determined storage location for the configuration parameter data. There are many possible objections to this code but you are required to focus here only on the security problems raised by it. (a) Explain in general terms what you understand by the idea of a buffer overflow attack. (5 marks) 5(b) Why is the updateConfigParams() function susceptible to a buffer overflow attack? (5 marks) (c) Explain in detail how, in this scenario, a buffer overflow attack on the updateConfigParams() function could be exploited to disable the alarm device. (5 marks) (d) How could the updateConfigParams() function be modified so that it were no longer susceptible to a buffer overflow attack? (5 marks) 3. Memory management It is important to illustrate your answers to this question with diagrams, when appropriate. (a) Describe the typical memory model of a user process (task), running under the control of an operating system. (5 marks) (b) Discuss the importance of memory protection in ensuring the reliability of a multi-tasking system. Describe a simple hardware mechanism that supports the implementation of memory protection. (5 marks) (c) What is address binding and when can it be done? Make sure that your answer clearly distinguishes between symbolic, relocatable and absolute addresses. (5 marks) (d) Explain the distinction between logical and physical addresses in the context of OS memory management. Describe a simple hardware mechanism that supports the mapping of logical to physical addresses. (5 marks) 65 Further information Learning Outcomes assessed in this assessment: 1. Describe the architecture of an operating system (OS) and its services, and evaluate its use in a variety of scenarios. 2. Discuss the process model and the scheduling, IPC and synchronisation services provided by an OS and reason informally about the behaviour of a multitasking system under a variety of scheduling algorithms. 3. Review the principal concepts and methods of memory management and file system implementation. 4. Identify a variety of security threats and examine appropriate OS mechanisms to protect against them. 5. Design, implement and evaluate solutions to problems of I/O device handling, synchronisation, communication and timing for multitasking systems, using appropriate OS services and concurrent programming techniques. Assessment Criteria/Mark Scheme: The coursework consists of 1. a software development project assessing low-level OS implementation and concurrency (50%) 2. a report on OS theory and concepts (50%) More detailed marks allocation is provided in the assignment brief. If you wish, you may collaborate with a partner for the software development and demonstration part of the assignment. If you choose to do so, you must inform the module tutor by email ([email protected]) to be received no later than 23.59 on 10th November 2014. This is a hard deadline. If you have not been named as a partner by the deadline, it will be assumed that you are undertaking this part individually. The rest of the assignment, i.e. the software project report and the theory and concepts report, must be entirely your own individual work. Referencing Style: IEEE 7Expected size of the submission: Your report should be about 5 to 7 A4 pages in length (assuming 10pt and normal margins). There is no fixed penalty for exceeding this limit but unnecessary verbosity, irrelevance and 'padding' make it difficult for the marker to identify relevant material and may lead to some loss of marks. Assignment weighting: 100% Academic Integrity Statement: You must adhere to the university regulations on academic conduct. Formal inquiry proceedings will be instigated if there is any suspicion of plagiarism or any other form of misconduct in your work. Refer to the University's Assessment Regulations for Northumbria Awards if you are unclear as to the meaning of these terms. The latest copy is available on the University website. Failure to submit: Note that failure to submit work or submission of work after the required deadline without an authorised late approval will result in a record of incomplete (IC) for the assessment component. Referral in that component will then be required even when the module is passed overall. 8