660 likes | 773 Views
ICT301 Concurrent Systems. Anthony Lee www.artofstudying.com. ICT301. 10 credits module 7 lectures – selected difficult topics 6 tutorials – practical sessions 3 TMAs. ICT301. 10 credits module 7 lectures – selected difficult topics 6 tutorials – practical sessions 3 TMAs
E N D
ICT301Concurrent Systems Anthony Lee www.artofstudying.com
ICT301 • 10 credits module • 7 lectures – selected difficult topics • 6 tutorials – practical sessions • 3 TMAs
ICT301 • 10 credits module • 7 lectures – selected difficult topics • 6 tutorials – practical sessions • 3 TMAs • Lecturer and tutors • Electronic conferences • Examination • References Bacon Tanenbaum Andrews
ICT301 • Block 1 – The Foundations • Nature of concurrent systems • Hardware and operating systems support • Processes, multi-threading Programming language needed
ICT301 • Block 2 – Inter-process Communications • Shared and non shared data • Shared and non shared memory • Problems and issues Not fact-based • Requires understanding
ICT301 • Block 3 – Application Considerations • System viability • Transactions • Distributed databases • Standards and mini case study
ICT301 Why study concurrent systems? The Story of “How to get Rich Quickly Without Studying ICT301”
Concurrent Systems Systems with several processes that: • contribute to overall objective • independent • cooperate among themselves • exchange data • synchronise actions • compete for resources • respond toexternal events • interact with external environment
level 7 elevator 3 bypasses a call at level 4 to go up because elevator 1 will be stopping at that level 3 level 6 4 level 5 elevator 1 answers the call at level 4 to go up because someone will be getting off from it at this level level 4 1 level 3 elevator 4 answers a call to go down level 2 2 elevator 2 discharging passengers at level 1 level 1
level 7 Service zone level 6 The system is dynamic and concurrent 4 level 5 level 4 Service zone 3 Service zone 1 level 3 level 2 Service zone 2 level 1
Concurrent Systems • How would the Java program looks like? class ElevatorController { public static void main(String args[ ]) { use for loop ? } }
Concurrent Systems • How would the Java program looks like? class ElevatorController { public static void main(String args[ ]) { use for loop ? } } • independent • cooperate • exchange data • synchronise actions • compete for resources • respond toexternal events • interact with external environment
Concurrent Systems • Inherently concurrent systems • Concurrent by nature • Potentially concurrent systems • Not concurrent by nature • But can be implemented as concurrent systems
Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems
Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Hard real time systems • Soft real time systems • Databases and transaction processing systems • Operating systems Aircraft Flight Controls Real time? Information up to date Hard or soft? Response time critical
Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Hard real time systems • Soft real time systems • Databases and transaction processing systems • Operating systems Aircraft Flight Controls Real time? Information up to date Hard or soft? Response time critical • Banking: ATM system • Real time? • Hard or soft? • Balance inquiry • Cash withdrawal
Recall our get-rich-quick story Bank accounts ATM GIRO Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems
Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems
Processor Disk Screen Memory Keyboard Printer Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems • Single user
Processor Disk Screen Screen Screen Processor Disk Keyboard Keyboard Keyboard Disk Memory Printer Plotter Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems • Single user • Multi-users
print server print server database server database server 1 1 2 2 3 3 4 4 workstation workstation workstation workstation Inherently Concurrent Systems • Typical inherently concurrent systems • Real-time and embedded systems • Databases and transaction processing systems • Operating systems • Single user • Multi-users • Networked users
Concurrent Systems • So far, inherently concurrent systems • Next, potentially concurrent systems
Potentially Concurrent Systems • Not concurrent by nature • Advantageous to implement concurrent processing • Usually in situations where • large amount of data • large amount of processing • real-time need • parallel processing possible
Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
Codes that process data Portion of data Codes that process data Portion of data Program that coordinates the processing . . . . . . Codes that process data Portion of data Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
Matrix operations 23 47 82 57 71 95 38 52 73 44 96 25 17 68 78 36 Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms Batch 1 Marked by examiner A
Marked by examiner A Marked by examiner B Marked by examiner A Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms Batch 1 Batch 2
Marked by examiner A Marked by examiner B Reviewed by moderator Marked by examiner A Marked by examiner B Marked by examiner A Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms Batch 1 Batch 2 Batch 3
Marked by examiner A Marked by examiner B Reviewed by moderator Marked by examiner A Marked by examiner B Marked by examiner A Marked by examiner A Marked by examiner B Reviewed by moderator Checked by checker Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms Batch 1 . . . Batch 2 Batch 3 . . . Batch 4 . . .
9 5 5 6 6 8 8 3 3 1 1 8 8 7 7 5 5 2 2 7 7 3 3 9 9 7 5 6 8 4 4 8 8 5 5 2 2 3 1 8 7 5 3 3 8 8 2 7 3 9 2 2 4 4 5 5 7 7 4 8 5 2 1 1 6 6 4 4 2 2 3 8 5 5 2 2 1 1 3 3 4 4 2 4 5 7 8 8 7 7 9 9 1 6 4 2 5 2 1 3 4 8 7 9 Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
7 5 6 8 3 1 8 7 5 2 7 3 9 4 8 5 2 3 8 2 4 5 7 1 6 4 2 5 2 1 3 4 8 7 9 7 5 6 8 7 5 6 8 3 1 8 7 5 3 1 8 7 5 6 2 7 3 9 8 2 7 3 9 4 8 5 2 4 8 5 2 3 8 3 8 2 4 5 7 2 4 5 7 1 6 4 2 1 6 4 2 5 2 1 3 4 5 2 1 3 4 8 7 9 8 7 9 Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
stage 1 stage 2 stage 3 stage 4 Potentially Concurrent Systems • Ways to implement concurrent processing • Replicated code with partitioned data • Partitioned code with duplicated data • Pipelined processing • Tree-structured algorithms
Potentially Concurrent Systems Fields for Applications • Artificial intelligence • Graphical imaging • Natural phenomena analysis • Engineering analysis • Mathematical modelling
Typical architecture Processor Disk Screen Memory Keyboard Printer Basic Computer Architecture Recall operating systems • inherently concurrent • closer look at what it has to do
fetch instruction Instruction 1 Instruction 2 Instruction 3 Instruction 4 Instruction 5 . . . update instruction pointer decode instruction Machine instructions execute instruction Basic Computer Architecture • CPU execution cycle • von Neumann architecture
The big speed difference Consider a 2 GHz CPU • Two thousand million cycles per second Consider human typing at 10 characters per second
The big speed difference Consider a 2 GHz CPU • Two thousand million cycles per second Consider human typing at 10 characters per second If CPU works at 1 cycle per second, human would be typing at one character every six years. Ratio is 200,000,000 to 1
The big speed difference Consider a 2 GHz CPU • Two thousand million cycles per second Consider a hard-disk transferring data at 10 megabytes per second
The big speed difference Consider a 2 GHz CPU • Two thousand million cycles per second Consider a hard-disk transferring data at 10 megabytes per second For every byte read from disk, CPU does about 200 cycles Ratio is 200 to 1
The big speed difference • Two implications arising from big difference in speed: 1. We need buffers 2. The CPU should be deployed elsewhere
The big speed difference • Two implications arising from big difference in speed: 1. We need buffers So the CPU does not have to wait while IO operations takes place
The big speed difference • Two implications arising from big difference in speed: 1. We need buffers 2. The CPU should be deployed elsewhere This means dividing its attention among many tasks
task 1 task 2 task 1 task 3 task 2 5 6 7 1 2 3 4 Basic Computer Architecture • Dividing CPU’s attention among many tasks time-slicing . . . . . . time interval
. . . . . . . . . task 1 task 1 task 2 task 1 task 3 task 2 . . . time interval 5 6 7 1 2 3 4 task 2 task 3 Basic Computer Architecture • Dividing CPU’s attention among many tasks time-slicing
Basic Computer Architecture • Dividing CPU’s attention among many tasks And we need interrupts Task 1 Interrupt service routine Task 2
Basic Computer Architecture • Dividing CPU’s attention among many tasks And we need interrupts Time allocated to a task is up Higher priority request from another program Request to update the real time clock Exceptions encountered in a program Completion of an IO operation