DOC PREVIEW
UNO CSCI 8530 - Time in Real-Time Systems QNX and POSIX

This preview shows page 1-2-3-4-5-6 out of 19 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSCI 8530 Advanced Operating Systems Time in Real Time Systems QNX and POSIX Scheduling Concerns Make sure something happens at or before a specific time Make sure something happens before something else Make sure your important job is not delayed if that delay is not a part of the application Provide guarantees as to the schedulability of a given task set 1 Tasks Processes and Threads A task for this discussion is some work that needs to be accomplished It could be done as part or all of the work done by a process or thread or a single process or thread could perform several tasks Processes and threads are objects dealt with by the operating system s scheduler without regard to what tasks these processes and threads are attempting to perform Rates and Responses A task can be one of several kinds something that must be performed repeatedly at a specified rate something that must provide a response within a certain period of time after an event occurs An example of a rate driven task is the continual updating of the temperature indicator for a reaction in a chemical plant Periodically with a fixed rate the sensor is read to obtain a value and that value is then written to a display The second kind of task might be associated with an overtemperature indication in the reaction After the temperature exceeds a given limit corrective action must be taken within a specified period of time 2 POSIX Scheduling Policies POSIX defines three scheduling policies SCHED FIFO preemptive priority based scheduling SCHED RR same as SCHED FIFO except that threads at the same priority are executed in a round robin fashion 50 msec timeslices in QNX SCHED OTHER implementation defined same as SCHED RR in QNX Controlling Scheduling Parameters sched setparam pid t pid struct sched param p is used to modify one or more scheduling parameters for process pid If pid is 0 the parameters for the calling process are changed Currently the only member of struct sched param is sched priority which is the priority associated with the process Future extensions may allow specification of other scheduling parameters such as a deadline by which the process must receive a certain amount of CPU time 3 sched getparam This function with parameters as for sched setparam will set the sched priority member of the struct sched param to the current priority of process pid or the current process if pid is 0 QNX currently returns the priority of the first thread in a multithreaded application but POSIX states that this function should return 1 in a multithreaded application The QNX specific functions getprio pid and setprio pid priority perform the same functions as the POSIX functions sched setparam and sched getparam Maximum and Minimum Priorities sched get priority max int policy returns the int maximum priority for a given policy which must be one of SCHED FIFO SCHED RR or SCHED OTHER sched get priority min int policy returns the int minimum priority for a given policy which must be one of SCHED FIFO SCHED RR or SCHED OTHER 4 sched setscheduler This POSIX function is used to specify the scheduling algorithm and the priority for a process It has three arguments pid which process is affected 0 means current process policy one of the three scheduling policies struct sched param as for sched setparam only sched priority member is currently used sched getscheduler This POSIX function returns the scheduling algorithm associated with a given process The only parameter is the process id if 0 is specified the scheduling algorithm for the calling process is return 5 Permissions for Making Changes As you might expect the functions that make changes to the scheduling algorithm and priority for a process must have appropriate privileges POSIX doesn t define what these are but indicates that an implementation must specify these QNX only allows processes with root privileges to change the scheduling algorithm Processes inherit the scheduling algorithm and priority from their parents To the Rear of the Queue Anytime you make a scheduling change to a process that process is moved to the rear of the queue for that particular state For example if you set your priority to its current value the system considers that a change and you are moved to the end of the queue of processes at the same priority 6 sched yield This POSIX function simply yields the processor to another process at the same priority If there are no other processes at that priority your process will continue to run Obviously if there were higher priority processes in the system you wouldn t be running in the first place Beware that another process that you expect to run as a result of sched yield may not in fact run if it isn t ready On some systems fork may take a finite time even after it returns in the parent to setup the child process Hardware Clocks Time of Day A time of day clock is a hardware device that records the current time of day Many such devices such as those used in a PC also record the date year month day day of week In a typical PC the hardware time of day clock is the MC146818 chip or equivalent and includes CMOS RAM to retain the time date etc even when the system is powered off assuming the battery is good 7 Hardware Clocks Periodic Another hardware clock is a device that generates an interrupt after a precise interval of time has elapsed Some clocks with very small intervals may be too fast to allow interrupt generation so they can only be set and later read see the next slide These clocks frequently have a periodic mode in which the interrupts occur repeatedly with the same time interval occurring between the interrupts Most UNIX systems have or support only one periodic hardware clock Many real time systems provide support for multiple realtime clocks In a typical PC the periodic hardware clock is actually the 8253 8254 8254 2 chip with a frequency of 1 19318 MHZ or a cycle time of about 0 838 sec The IA32 TimeStamp Counter Modern Intel and other processors include a timestamp counter which is reset to 0 when the processor is reset and is incremented by 1 with each processor clock cycle This counter cannot be set except to reset it to 0 or used to generate interrupts at a certain time in the future It can only be read using the RDTSC instruction It is used to provide high resolution measurement of time periods 8 Clocks Working Together The time of day clock is often used to set the system s concept of the time of day during the booting process Thereafter


View Full Document

UNO CSCI 8530 - Time in Real-Time Systems QNX and POSIX

Download Time in Real-Time Systems QNX and POSIX
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Time in Real-Time Systems QNX and POSIX and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Time in Real-Time Systems QNX and POSIX 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?