Download presentation
Presentation is loading. Please wait.
1
A. Frank File Organization Stream Model מודל תזרים Thanks to Adi Gutman and Noa Cohen
2
2 A. Frank Stream Model Provides a general model of a File. Has all the power needed for handling a file but does it with a minimal infrastructure. All other file models/systems can be modeled by (based on) it.
3
3 A. Frank Why Stream? Stream model is based on Insertion mode (not Replace/Overwrite mode). A File is like a stream (sequence) of units that is to be read or written.
4
4 A. Frank 1. סדרה של n יחידות נתונים )זהות( ממוענות באופן לוגי מ-0 עד n-1 0 n – 1 12 2. i – מצביע ליחידה הנוכחית var i: POSITION; n – מספר היחידות בקובץ var n: POSITION; i = 0, 1, 2, …, n-1, n הם ערכים חוקיים. כאשר = EOF מען n (מייצג מען להוספה בסוף הקובץ). n לא מוגבל! האם למדל n או EOF? i = 1 Stream Model Infrastructure (1) n מען EOF = n
5
5 A. Frank 0 n – 1 12 3.buf - מכלא var buf: UNIT; זהו שטח אחסון זמני (בזיכרון הפנימי) בגודל יחידת נתונים. מאפשר העברת יחידה נוכחית מהקובץ ל-buf וההפך. i = 1 buf Stream Model Infrastructure (2) n מען EOF = n
6
6 A. Frank 1. הבאה buf := fetch() 2. הוספה insert(buf) 3. ביטול delete() 4. חיפוש seek(j) Four basic operations Four Primitives:
7
7 A. Frank הבאה היא קריאת היחידה הנוכחית, i, לתוך המכלא buf. (פעולה לא-הרסנית – Non-destructive) n – 1 0 12 i = 1 buf n – 1 0 12 i = 1 buf buf := fetch()
8
8 A. Frank הוספת היחידה שהוכנה ב-buf לקובץ (מספר היחידות בקובץ גדל באחד). מיקום היחידות i,…, n-1 משתנה ל- i+1,…, n ) פעולה הרסנית – Destructive) buf n - 1 0 1 i -1 i i i +1 n 0 1 i -1 i i i +1 buf insert(buf)
9
9 A. Frank ביטול היחידה במקום ה-i (מספר היחידות בקובץ קטן באחד). מיקום היחידות i+1, …, n-1 משתנה ל- i, …, n-2 n - 1 0 1 i i i +1 i +2 n - 2 0 1 i i i +1 delete()
10
10 A. Frank חיפוש הוא הזזת המצביע מיחידה i ליחידה j בתחום המותר ( (0 n j -1 0 i i i +1 j j -1 0 i i i +1 j seek(j)
11
11 A. Frank So what’s beyond the Stream Model? Isn ’ t the Stream Model too primitive? Does it really have the needed power? How can we further build on the base of the Stream Model? How to make it more user-friendly?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.