Last Covered
Download
Report
Transcript Last Covered
Last Covered (almost)
• Variety of middleware mechanisms
Gain?
Enable n-tier architectures while not
necessarily using a browser
and all that accompanies a
distributed structure
18 September 2008
#1
CIS 340
Can you answer?
How are object-based MW
different from message-based
MW?
How is a “monitor” different from
a “broker” system?
18 September 2008
#2
CIS 340
Topics
•
•
To understand ACID as defining
database needs of an operating
system
To understand the operating system
•
•
•
18 September 2008
Basic responsibilities
Standard enhancements
Distributed processing support
#3
CIS 340
ACIDS: ACID + Serializability
Def:
• The assurance governing concurrent
execution
Goal:
Several transactions occurring
yield consistent results
ANSI standard specification:
A transaction sequence continues from
beginning to end
-- through all succeeding SQL statements –
until:
– COMMIT statement is reached
– ROLLBACK statement is reached
– End of program is reached
– Program is abnormally terminated
18 September 2008
#4
CIS 340
Data management (concept)
• Commit -making a set of tentative changes permanent
• Rollback - an operation which returns the database to some
previous state.
– Rollbacks are important for database integrity, because they
mean that the database can be restored to a clean copy even
after erroneous operations are performed
• Integrity
– Entity integrity concerns the concept of a primary key. Entity
integrity is an integrity rule which states that every table must
have a primary key and that the column or columns chosen to
be the primary key should be unique and not null.
– Referential integrity concerns the concept of a foreign key.
• no child record can exist without a parent
18 September 2008
#5
CIS 340
Classic Problems for Shared DBs
Data integrity and consistency problems
– Lost updates
– Uncommitted data
– Inconsistent retrievals
18 September 2008
#6
CIS 340
Lost Updates
Normal Execution: T1: PRO_QOH=PRO_QOH+100, T2: PRO_QOH=PRO_QOH-30
Problematic Execution
18 September 2008
#7
CIS 340
Uncommitted Data
Correct Execution of Two Transactions T1: PRO_QOH=PRO_QOH+100 (Rollback), T2: PRO_QOH=PRO_QOH-30
Data Never Reached Commit, But Still Appears
18 September 2008
#8
CIS 340
Inconsistent Retrievals
Valid Retrieval During Update: T2: correction of typing error 10 units
Data Entry Correction
18 September 2008
#9
CIS 340
Inconsistent Retrievals
Can READS ever get wrong values?
Inconsistent with circumstances?
The “Scheduler”
• Utility of DBMS
• Establishes order of operations
among concurrent transaction
How?
• Interleaves execution
Uses concurrency control algorithms
• Ensures serializability
• Ensures isolation of transactions
Goal: So two transactions do not update same data
element at same time
18 September 2008
# 11
CIS 340
The “Scheduler”: Read/Write Conflict Matrix
No problem if T1 and T2 access unrelated data
Possible confliction:
1) Access same data
2) At least one of them is a Write operation
18 September 2008
# 12
CIS 340
Concurrency Control: Locking
Lock
– Excludes use of a
Def:
data item
– Required
– Prevent reading
inconsistent data
Lock Granularity
– Level of lock use
Lock Manager
– Assigns & polices
locks
– Enables different
degrees of speed
to the
concurrency
18 September 2008
• Database
• Table
• Page
• Row
• Field
# 13
CIS 340
Highlights
Transaction log
Concurrency control
Scheduler
Lock
Serializability
Deadlock
Prevention;
Detection;
Avoidance
Keeps track of all transactions
that modify database
Coordinates simultaneous
execution of transactions
Responsible for sequencing
concurrent operations
Guarantees unique access to a
data item
Guaranteed through the use of
two-phase locking
When two or more transactions
wait indefinitely for each other
to release lock
Deadlock control techniques
Transactional Properties:
ACID Test
CLIENT
CLIENT
SERVER
If several components must come
together for a process, then each
atomic process operates
correctly or entire combination
aborts
C onsistency:
A service is correct when
executed in its entirety and false
or incorrect data is not
introduced into the component
databases
services
user
program
A tomicity:
transactional
coordination
I solation:
If several clients request the
same service at the same time
and access the same data, the
overall result will be as if they
were alone – isolated -- in the
system
TP-Monitor
D urability:
Application 1
Application 2
18 September 2008
Completed transactions are complete
and durable (have duration?)
If necessary, redoing and undoing
of changes in case of failures can
occur
Application 3
# 16
CIS 340
Simple Batch Systems
“Monitors”
• Software
• Controlled sequence of events
• Program branches back to monitor when
finished
Job Control Language (JCL)
• Special type of programming language
• Provides instruction to the monitor
– What compiler to use?
– What data to use?
18 September 2008
# 17
CIS 340
Time Sharing
• Uses multiprogramming to handle
multiple interactive jobs
• Processor’s time is shared among
multiple users
• Multiple users simultaneously access
the system through terminals
18 September 2008
# 18
CIS 340
EX: Multiprogramming and Multiprocessing
18 September 2008
# 19
CIS 340