留学生计算机作业参考案例:Real Time Operating Systems Computer Science Essay

论文价格:免费 论文用途:留学相关 overseas related 编辑:硕博论文网 点击次数:
论文字数:2871 论文编号:sb2022013011275643434 日期:2022-12-17 来源:硕博论文网
本文是计算机专业的留学生作业范例,题目是“Real Time Operating Systems Computer Science Essay(实时操作系统计算机科学论文)”,实时操作系统是指实时操作系统的操作系统。这些操作系统具有专门用于在最后期限内检测和响应现实世界中的任务的功能。根据实时系统是硬的还是软的,RTOS是根据每个系统的需求设计的。RTOS在功能和设计上都不同于通用操作系统,本文将对此进行详细的讨论。在RTOS内核的众多功能中,任务管理是最关键的功能之一。任务管理需要动态或静态地分配任务并据此调度它们。考虑到实时世界的严格要求,在选择合适的调度机制时需要考虑几个因素。市面上有几种实时操作系统,可用于降低初始工程和设计成本和时间。本文讨论了RTOS与通用操作系统的区别、RTOS所需要的功能、RTOS内核和任务管理机制。最后讨论和分析了商业上可用的实时操作系统。
Abstract 摘要
Real Time Operating Systems are Operating Systems for systems operating in Real Time. These Operating Systems have functions dedicated to detecting and responding to tasks from the real world within their deadlines. Depending on whether the real time system is hard or soft, the RTOS is designed to the needs of each system. RTOS differs from General purpose Operating System in function and design and will be discussed in detail in this paper. Among the many functions of the RTOS kernel, task management is one of the most critical function. Managing Tasks entails dynamically or statically assigning tasks and scheduling them accordingly. Given the stringent requirements of the real time world, several factors need to be considered when selecting the right scheduling mechanism. Several Real Time Operating Systems exist commercially that can be used to reduce initial engineering and design costs and time. This paper discusses differences between the RTOS and General Purpose Operating Systems, desired functions of the RTOS, the RTOS kernel and Task Management mechanisms. It concludes with the discussion and analysis of commercially available Real Time Operating Systems.
Real Time Systems are systems that are subject to real time limitations and are expected to deliver services within strict time boundaries [1]. The correctness of such systems depends not only on computational output, but also on the instant at which the system produces the output.
实时系统是受实时限制的系统,并期望在严格的时间边界[1]内交付服务。这种系统的正确性不仅取决于计算输出,还取决于系统产生输出的时间。
1.Real Time Operating Systems versus General Purpose Operating Systems 实时操作系统与通用操作系统
Systems that function in real time situations have different and more challenging requirements than other systems. An example would be an Air Traffic Control System, where the correctness of the system not only lies in the right output but timely output. An untimely response could cost human lives. This would be a case of hard real time system where delay in output could be catastrophic. The Operating System would need to manage with several external events and produce output in a timely manner. RTOS is designed with features that would enable it to handle such tough real time situations.
与其他系统相比,在实时情况下运行的系统有不同且更具挑战性的需求。例如空中交通管制系统,系统的正确性不仅取决于输出的正确性,还取决于输出的及时性。不及时的反应可能会使人丧命。这将是一个硬实时系统的情况,输出延迟可能是灾难性的。操作系统将需要管理几个外部事件,并及时地产生输出。RTOS的设计特性使得它能够处理这样艰难的实时情况。
We need to note that not all real time systems require an operating system. Examples would be microwave ovens and washing machines, where there is minimal user interaction and only a combination of a few tasks. The system could be hardwired as implementing an Operating System would be too expensive for a simple system.
RTOS, in comparison with a General Purpose Operating system is designed to enable effective sharing of resources with many processes and producing output quickly. In an RTOS, a scheduling algorithm is implemented for this purpose. A General Purpose operating system on the other hand uses the “fairness” policy whereby each task is given an equal amount of time and resources to every application and task [2]. Hence, there is no differentiation between urgent tasks and other tasks. Moreover, the time at which output can be generated is not predictable in a GPOS. Hence, these qualities make GPOS unsuitable for real time conditions.
Basic Features of the RTOS
Though Real Time Operating Systems differ depending on the application for which it is designed, there are a few basic features expected. These features are discussed briefly below.
Timeliness
Timeliness is a crucial factor when designing RTOS especially for Hard Real Time systems which are safety or mission critical. In order to achieve timeliness, the RTOS has to be able to handle multiple tasks simultaneously. Multi threading needs to be used to achieve this.
Multithreading is the efficient management of multiple threads where each thread is assigned a task. All threads share resources from a single core. A scheduler is designed to assign priorities to threads and ensure higher priority threads can preempt the lower priority threads to access the CPU when they need them.
Determinism
In order for the Real time operating system to function in a predictable manner, latencies in operation need to be predicted and delays need to be defined. The common latencies are as follows. Task switching latency is the time between saving the state of the current task and the start of the next task. Interrupt latency is the time taken for an interrupt to be executed. Interrupt dispatch latency is the time taken from the interrupt completion time to the starting time of the next task. The static scheduler predefines the duration taken for each task to execute so that the Real Time System has a more deterministic and controlled behavior.
Data Integrity
Resources are shared between threads and hence the same data may be modified by two or more strings at the same instance. To ensure data integrity, mutexes are used. A mutex allows exclusive access to the resource. A mutex can be in the locked state or the unlocked state. When a task is in progress with a resource, the mutex is in a locked state. When the task is done, it unlocks the mutex and only then any other task can modify that resource.
POSIX Compliance
POSIX stands for Portable Operating System Interface for Computer Environments. POSIX 1003.1b provides the standard for Real Time Operating System to comply to. Compliance to such standards makes the RTOS easily portable across platforms.
2.The RTOS Kernel RTOS内核
The Kernel, like in other Operating Systems, is the most important part of the RTOS. It acts as an interface between the top level application layer, which can be accessed by users, and the hardware layer, consisting of the data processing hardware components.
和其他操作系统一样,内核是RTOS中最重要的部分。它是用户可以访问的顶级应用层和由数据处理硬件组成的硬件层之间的接口。
The responsibilities of the RTOS kernel are illustrated in Figure 2. The central duty of the kernel is to manage tasks. In an RTOS, a task is a basic unit of execution. Task management involves assigning these threads / tasks priority levels. A task that needs to be completed with a tighter deadline and has a larger impact on the output is normally given a higher priority. Apart from creating priority for threads, the kernel needs to manage priority inversion situations efficiently and ensure that the higher priority threads get resources as soon as they need them.
Memory management is an important task of the kernel. With many threads using the memory, the system will run out of memory if the threads that have completed do not return the memory back to the system. The memory in an RTOS is usually small in size and only used for user application, hence needs to be managed efficiently. In a few Real time operating systems, temporary memory divided into fixed sizes, is allocated to tasks. Once the tasks have executed, they must return the memory block back to the memory pool. Lower priority tasks are allocated smaller memory blocks while higher priority tasks are allocated larger memory blocks. When a lower priority task requires more memory, it has to wait till a memory block is returned to the pool before continuing execution.
Though the above functionalities are general, features of the kernel differ depending on the usage of the Real Time Operating System. A few of the common categories of kernels would be, Small, proprietary kernels, real time extensions to kernels of general purpose operating systems, and component-based kernels.
留学生作业辅导
留学生作业辅导
3.Small, proprietary kernels 小型专有内核
This category of kernels is used where the real time system has tight deadline to meet. These kernels have very few functionalities and very well defined tasks to handle. Hence, the response time of these kernels are predictable and suitable for use in hard real time systems. These kernels are highly customized and can be designed in-house or commercially available.
这类内核用于实时系统必须在很短的时间内完成的情况。这些内核只有很少的功能和非常明确的任务要处理。因此,这些内核的响应时间是可预测的,适合在硬实时系统中使用。这些内核是高度定制的,可以在内部设计,也可以在商业上使用。
A few of the special features of these kernels are the short context switching duration, limited features and hence lower overhead, shorter duration when the interrupts are disabled, priority based preemptive scheduling, etc. These features enable the RTOS to respond quickly to events in a predictable manner.
4.The Real Time Task 实时任务
A task instance in a real time operating system is triggered each time an associated event occurs. The task then carries out the response to the event. Important aspects of tasks are computation time, resource requirements, criticality, relationship with other tasks and deadlines.
实时操作系统中的任务实例在每次相关事件发生时都会被触发。然后,任务执行对事件的响应。任务的重要方面是计算时间、资源需求、临界性、与其他任务的关系和最后期限。
Tasks can be periodic whereby they occur within fixed intervals of time. Such tasks can be triggered by an internal clock. The clock generates an interrupt at the precise instant of time, which then calls the task. These tasks are termed clock driven tasks. A typical example of a real time system that should have periodic tasks is monitoring devices. Pressure, temperature, and such variables would need to be measured at fixed time instances. Hence, a periodic task can handle this requirement.
Tasks that do not occur in fixed instants of time are aperiodic. Aperiodic tasks can be represented in terms of the worst case execution time, time between two instances of the same task and the deadline of the task. Given limited resources, the time between two instances of the task has to be greater than the worst case execution time.
5.Task Scheduling 任务调度
RTOS, unlike General Purpose Operating Systems, do not divide resources and time equally among tasks. The Scheduler dictates when and how long a task can execute depending upon its priority and the scheduling algorithm. The Scheduling Algorithm is integral for tasks to be able to get hold of required resources and CPU time, very swiftly so that they can be executed within their deadlines.
与通用操作系统不同,RTOS不能在任务之间平均分配资源和时间。Scheduler根据任务的优先级和调度算法决定任务何时和多长时间可以执行。对于任务来说,调度算法是必不可少的,它能够非常迅速地获得所需的资源和CPU时间,以便它们能够在限期内执行。
Static scheduling algorithms are used when the priority of tasks do not change throughout the execution. The schedule of the tasks is worked out even before the execution. The schedule is computed with the worst case timings so that the tasks would meet their assigned deadlines in all situations.
The List Scheduling algorithm is useful when the system carries out very few tasks and in safety critical systems since it ensures predictability. However, in systems with several tasks which are interdependent on each other, share resources, and are a mixture of periodic and aperiodic tasks, the above schedule might not be feasible. Therefore, Static Scheduling could be used for the most critical operations with hard deadlines and for other tasks, a more suitable algorithm could be used.
Priority Driven Preemptive Approach schedules tasks based on their priorities. The algorithm proposed by Liu and Layland, Rate Monotonic Analysis (RMA), is one of the first and most common Priority driven preemptive Scheduling algorithm. In this algorithm, tasks are given priorities based on their execution period. The task with the smallest period is given the highest priority, while that with the largest period is given the lowest priority. A task of a higher priority can preempt a task of a lower priority. Once the higher priority task has finished executing, CPU will be handed back to the lower priority task to complete its execution. CPU Utilization, a key issue in RMA, is defined as the percentage of time spent executing the tasks.
留学生作业辅导范文参考
留学生作业辅导范文参考
6.Priority Inversion 优先级反转
A common solution to the Priority Inversion Problem is Priority Inheritance. This method utilizes the mutex which allows mutually exclusive task execution.Another common solution to the Priority Inversion problem is Priority Ceiling. This method assigns all mutexes a ceiling priority. This ceiling priority is the priority of the highest priority task that would use the mutex. Any task that locks the mutex will gain the priority assigned to the mutex. Hence, this task cannot be preempted till it completes execution.
优先级反转问题的一个常见解决方案是优先级继承。此方法利用允许互斥任务执行的互斥量。优先级反转问题的另一个常见解决方案是优先级上限。这个方法为所有互斥对象分配一个上限优先级。这个上限优先级是使用互斥锁的最高优先级任务的优先级。任何锁定互斥锁的任务将获得分配给该互斥锁的优先级。因此,这个任务在完成执行之前不能被抢占。
This task uses the resource PRNT for its execution. While in progress, another task B of higher priority attempts to preempt Task A. Task B also requires resource PRNT for its execution, and hence is not able to preempt Task A. Meanwhile, other tasks C and D, higher in priority than A preempt task A and are successful in doing so because they do not require the PRNT resource. After task C and D execute, CPU is handed back to Task A to complete. After Task A completed, Task B, which is of the highest priority, executes. This inversion in priority could cause detrimental consequences in hard real time systems.
There are several commercial operating systems available now with comprehensive Integrated Development Environments and debuggers. Usage of these commercially available RTOS will enable time and cost savings and reduce time to market. However, whether commercial RTOS is used or an RTOS is developed in house, its features need to be carefully considered and selected with the nature of the real time system in mind.
现在有几个商业操作系统提供了全面的集成开发环境和调试器。使用这些商用RTOS将节省时间和成本,并缩短上市时间。然而,无论使用商用实时操作系统还是自行开发的实时操作系统,都需要根据实时系统的性质仔细考虑和选择其特性。
留学生作业相关专业范文素材资料,尽在本网,可以随时查阅参考。本站也提供多国留学生课程作业写作指导服务,如有需要可咨询本平台。

如果您有论文相关需求,可以通过下面的方式联系我们
点击联系客服
QQ 1429724474 电话 18964107217