18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain?...

Post on 20-Jan-2018

215 views 0 download

description

18 September 2008CIS 340 # 3 Topics To understand ACID as defining database needs of an operating system To understand the operating system Basic responsibilities Standard enhancements Distributed processing support

Transcript of 18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain?...

18 September 2008 CIS 340# 1

Last Covered (almost)• Variety of middleware mechanisms

Gain?

Enable n-tier architectures while not necessarily using a browser

and all that accompanies a and all that accompanies a distributed structuredistributed structure

18 September 2008 CIS 340# 2

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 CIS 340# 3

Topics• To understand ACID as defining

database needs of an operating system

• To understand the operating system• Basic responsibilities• Standard enhancements• Distributed processing support

18 September 2008 CIS 340# 4

ACIDS: ACID + Serializability

• 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

Def:Def:

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 CIS 340# 5

18 September 2008 CIS 340# 6

Classic Problems for Shared DBs

Data integrity and consistency problemsData integrity and consistency problems– Lost updates– Uncommitted data– Inconsistent retrievals

18 September 2008 CIS 340# 7

Lost Updates

Normal Execution: T1: PRO_QOH=PRO_QOH+100, T2: PRO_QOH=PRO_QOH-30

Problematic Execution

18 September 2008 CIS 340# 8

Uncommitted DataCorrect 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 CIS 340# 9

Inconsistent RetrievalsValid Retrieval During Update: T2: correction of typing error 10 units

Data Entry Correction

Inconsistent RetrievalsCan READS ever get wrong values? Inconsistent with circumstances?

18 September 2008 CIS 340# 11

The “Scheduler”“Scheduler”• Utility of DBMS• Establishes order of operations

among concurrent transaction

How?• Interleaves execution

Uses concurrency control algorithms • Ensures serializability

• Ensures isolation of transactionsGoal: So two transactions do not update same data

element at same time

18 September 2008 CIS 340# 12

The “Scheduler”“Scheduler”: Read/Write Conflict Matrix

No problem if T1 and T2 access unrelated data Possible confliction:1)Access same data2)At least one of them is a Write operation

18 September 2008 CIS 340# 13

Concurrency Control: LockingLockingLock

– Excludes use of a data item

– Required – Prevent reading

inconsistent data

Lock Manager– Assigns & polices

locks

Lock Granularity– Level of lock use

• Database• Table• Page• Row• Field

– Enables different degrees of speed to the concurrency

Def:Def:

Highlights

Transaction log Keeps track of all transactions that modify database

Concurrency control Coordinates simultaneous execution of transactions

Scheduler Responsible for sequencing concurrent operations

Lock Guarantees unique access to a data item

Serializability Guaranteed through the use of two-phase locking

Deadlock When two or more transactions wait indefinitely for each other to release lock

Prevention;Detection;Avoidance

Deadlock control techniques

18 September 2008 CIS 340# 16

Transactional Properties:

ACID Test

A A tomicity: If several components must come together for a process, then each

atomicatomic process operates correctly or entire combination

aborts

C C onsistency: A service is correct when

executed in its entirety and false false or incorrect data is not or incorrect data is not

introducedintroduced into the component databases

I 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 --– isolated -- in the

system

D D urability: Completed transactions are complete are complete

and durable (have duration?)and durable (have duration?)If necessary, redoing and undoing of changes in case of failures can

occur

TP-Monitor

transactional coordination

CLIENT

services

Application 1 Application 3Application 2

user program

CLIENT

SERVER

18 September 2008 CIS 340# 17

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 compiler to use?– What data to use?What data to use?

18 September 2008 CIS 340# 18

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 CIS 340# 19

EX: Multiprogramming and Multiprocessing