110 likes | 292 Views
University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and Real Time programming Introduction. Outlines. Concurrency Real time systems. Concurrency.
E N D
University of PalestineFaculty of Applied Engineering and Urban PlanningSoftware Engineering DepartmentConcurrent and Real Time programmingIntroduction Instructore: Tasneem Darwish
Outlines • Concurrency • Real time systems Instructore: Tasneem Darwish
Concurrency • Concurrent programming is the name given to the notations that are used to express parallelism in an application program. • Concurrent programming also expresses the techniques for dealing with communication and synchronization between parallel entities. Instructore: Tasneem Darwish
Concurrency • why to use concurrency? • To fully utilize the processor (the processor is so fast with respect to the I/O devices) • To allow more than one processor to solve a problem ( A sequential program can only be executed by one processor. A concurrent program is able to exploit parallelism and obtain faster execution). • To model parallelism in the real world (Real-time and embedded programs have to control and interface with real-world entities (robots, conveyor belts, etc.) that are inherently parallel). Instructore: Tasneem Darwish
Concurrency • Concurrency problems: • Concurrent activities need to coordinate their actions. • the coordination can involve intricate patterns of communication and synchronization. • Not managing communication and synchronization very well can result in new error arising. Instructore: Tasneem Darwish
Concurrency • Examples of problems in concurrent programs: • deadlock may occur where each concurrent activity is waiting for another to perform an operation • interference may occur when two or more concurrent activities attempt to update the same object; this can result in the object's data becoming corrupt; • starvation may happen where one or more concurrent activities are continually denied resources as a result of the actions of the others. Instructore: Tasneem Darwish
Concurrency • The desired concurrent program • The desired behaviour of a concurrent program is safety and aliveness. • The safety property expresses the requirement for "nothing bad to happen“ (the concurrent activities do not interfere with each other and cause data corruption). • The aliveness property expresses the requirement that "something good will happen". (concurrent activities are able to make progress and do not suffer from deadlocks or starvation). Instructore: Tasneem Darwish
Concurrency • How deadlocks happen? • There are four necessary conditions that must exist if deadlock is to occur. • Mutual exclusion (only one concurrent activity can use a resource at once) • Hold and Waite (there must exist concurrent activities that are holding resources while waiting for others resources to be acquired) • No pre-emption (resources acquired by a concurrent activity cannot be forcibly taken away from it by another activity.) • Circular wait (a circular chain of concurrent activities must exist) Instructore: Tasneem Darwish
Real Time systems • real-time systems are systems that have to respond to externally generated input within a finite and specified time interval. • They are inherently concurrent because they are often embedded in a larger engineering system and have to model the parallelism that exists in the real-world objects that they are monitoring and controlling. • The RTSJ extends the Java concurrency model to allow it to interact with external events. Instructore: Tasneem Darwish
Real Time systems • Some real-time systems characteristics: • Large and complex. • Extremely reliable and safe. • Interaction with hardware interfaces. Instructore: Tasneem Darwish
Real Time systems • Hard and soft real time systems: • Hard real-time systems are those where it is absolutely important that responses occur within the specified deadline. • Soft real-time systems are those where response times are important, but the system will still function correctly if deadlines are missed. • In interactive systems there are no explicit deadlines. Instructore: Tasneem Darwish