File organisation and access
הוצג
15:07
סוגי נתונים מוגדרים על ידי משתמש
שדה טקסט פשוט יאחסן בקלות נתונים חסרי משמעות. תבקשו סוג רכב, ואדם יכתוב "בננות" — התוכנה תקבל זאת ללא התנגדות. אך אם ת…
קריינות באנגלית · כתוביות באנגלית ובסינית 中文 שאפשר להחליף ביניהן
בשיעור הזה
| English | משמעות |
|---|---|
| magnetic tape | A storage medium that stores data on a long strip read in order. |
| transactions/trænˈsækʃnz/ | Actions that move money into or out of bank accounts. |
| master file | The main collection of records kept and updated over time. |
| file/faɪl/ | A collection of records stored at positions calculated from their keys. |
| Disks | Storage media that allow data to be read directly from known positions. |
| record/ˈrekɔːd/ | A stored collection of information about an item, person or event. |
| key/kiː/ | A value used to identify or look up an associated item, such as a key in a dictionary or database. |
| file organisation/faɪl ˌɔːɡənaɪˈzeɪʃn/ | ארגון קבצים |
| serial file/ˈsɪərɪəl faɪl/ | קובץ סדרתי |
| Appending | Adding new data or records to the end of a file. |
| searching/ˈsɜːtʃɪŋ/ | The process of looking through data to find a wanted item. |
| logs | Files that keep records of events or actions as they happen. |
| audit trails | Records of actions that allow changes and events to be checked later. |
| sequential file/siːˈkwenʃl faɪl/ | קובץ רצף-סדרי |
| sorted by a key field | Arranged in order according to the values in a chosen field. |
| binary-search | A search that repeatedly halves an ordered set of records to find a value. |
| batch/bætʃ/ | A group of tasks or records processed together at one time. |
| Direct access/daɪˈrekt ˈækses/ | Reading a record at a known position without reading earlier records. |
| record key | A value that uniquely identifies one record in a file. |
| hash/hæʃ/ | A function that calculates an initial storage address from a record key. |
| Lookup | The process of finding a record or value using a key. |
| lookup tables | Collections of stored values that can be found using keys. |
| access method/ˈækses ˈmeθəd/ | שיטת גישה |
| Sequential access/siːˈkwenʃl ˈækses/ | Reading records in order from the start until the wanted record is reached. |
| random file/ˈrændəm faɪl/ | קובץ אקראי |
| indexed/ˈɪndekst/ | Describes data organised with a separate structure that helps the database find records faster. |
| scan/skæn/ | A search that reads records in order to find the wanted data. |
| collisions/kəˈlɪʒnz/ | A conflict such as different keys mapping to the same hash location, or simultaneous transmissions interfering on a shared network medium. |
| web server/web ˈsɜːvə/ | A computer or program that sends web content when users request it. |
| Hashing/ˈhæʃɪŋ/ | The process of calculating an initial record address from a key. |
| record address | The position in storage where a record is or can be placed. |
| algorithm/ˈælɡərɪθəm/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| overflow area/ˌəʊvəˈfləʊ ˈeərɪə/ | Extra storage used for records whose calculated file or hash-table locations are already occupied. |
| pointer/ˈpɔɪntə/ | A value that identifies a memory location or refers to another stored object. |
| chain/tʃeɪn/ | A series of connected records reached by following links between them. |
| key field/kiː fiːld/ | שדה מפתח |
מדוע העבודה הלילית של הבנק נמשכה כל הלילה
- בשנות ה-1980 חשבונות הבנק נשמרו על סרט מגנטי. סרט ניתן לקריאה רק מקצה אחד לאחר, ולכן העסקאות של היום נסדרו בלילה והקובץ הראשי כולו נקרא מהתחלה לסוף, פעם אחת, כדי ליישם אותן.
- אם ביקשת את יתרת לקוח באמצע היום, התשובה הייתה: לא לפני מחר. ארגון הקובץ, ולא מהירות המחשב, קבעו מה שהבנק יכול להציע.
- דיסקים אפשרו ארגון שונה: לחשב את מיקום הרקורד מתוך המקדם שלו ולקפוץ לשם. זה בדיוק מה שמאפשר למכונת אוטומטית לתג תוך שנייה.
- שיעור זה עוסק בארגון קבצים, בשתי שיטות הגישה, ובאיך לבחור מתוך מה שהתוכנה עושה בעיקר.

שלושה ארגונים
- קובץ סריאלי (סדרתי) מכיל רקורדים בסדר ההופעה שלהם, ללא סינון. הוספה היא מהירה; חיפוש דורש קריאה מהתחלה. משמש ליומני מערכת ונתיבי בדיקה.
- קובץ סדרתי מכיל רקורדים ממוינים לפי שדה מקדם. החיפוש מהיר יותר, כי ניתן לעצור מוקדם או לבצע חיפוש בינארי; ההוספה איטית, כי רקורדים מאוחרים צריכים להזיז. משמש לקבצי ראשיים המועברים בקבוצות.
- קובץ רנדומלי (או קובץ בגישה ישירה) מכיל כל רקורד במיקום המחושב מהמקדם שלו, בדרך כלל באמצעות פונקציית Hash. חיפוש לפי מקדם הוא מאוד מהיר; קריאה בסדר המקדמים היא לא נוחה. משמש לטבלאות חיפוש גדולות וחשבונות לקוחות.

סריאלי: סדר ההופעה, אין יותר

סדרתי: אותו סוג רקורדים, בסדר מקדם


שתי שיטות הגישה
- גישה סדרתית קוראת מהתחלה של הקובץ ועד לרקורד הרצוי. זוהי הגישה היחידה שקובץ סריאלי מאפשר, וכך מעובד קובץ סדרתי בקבוצות.
- גישה ישירה מקפיצה ישירות למיקום ידוע ללא קריאה של מה שמגיע לפני כן. זוהי הדרך שבה נקרא קובץ רנדומלי, וקובץ סדרתי יכול גם כן להיות נקרא ישירות כאשר מיקום המקדם ידוע או מאונדקס.
- לכן זוגיות הסילבוס היא: גישה סדרתית לקבצים סריאליים וגם סדרתיים; גישה ישירה לקבצים סדרתיים וגם רנדומליים.

רנדומלי: המקדם אומר לך איפה לחפש

File access route
Follow a file from storage to program and back safely.
A serial file stores records:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Serial files keep records in arrival order — fast to append, slow to search. Sequential files are sorted by key.
Match each file organisation to how it stores records.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Serial = arrival order; sequential = sorted; random = hashed position; indexed-sequential = sorted + an index.
A random (direct-access) file places each record:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
A key is converted (often by a hash) to a position, so a single-key lookup is very fast.
What is the difference between a serial file and a sequential file?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Order of arrival versus sorted by key. That single difference is what makes a sequential file searchable early and slow to insert into.
דוגמה פתורה: בחירת הארגון
- תוכנת משכורות קוראת כל רקורד של עובד פעם בחודש, בסדר מספר עובד, כדי להפיק שוטרי שכר. איזה ארגון ואיזו גישה, ולמה?
- ארגון סדרתי עם גישה סדרתית: כל רשומה מעובדת, ולכן אין יתרון לקפוץ בין נקודות, ואחסוןן בסדר מפתחות אומר שהצ'קים יוצאים בסדר ללא צורך בשלב מיון.
- מכונת אוטומט חייבת למצוא חשבון אחד לפי מספרו תחת שנייה. ארגון אקראי עם גישה ישירה: המיקום מחושב מהמספר של החשבון, ולכן נדרשת קריאה אחת בדיוק במקום לחפש במיליונים.
- אפליקציית שרת אתר מצרפת שורה אחת לכל בקשה ללוג. סדרתי: רק הצרפה חשובה, והצרפה בסוף היא הפעולה המהירה ביותר שאקבץ סדרתי יכול לבצע.

A sequential file can be read by sequential access and also by direct access.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Sequential access serves serial and sequential files; direct access serves sequential and random files. Only a serial file is limited to one method.
Put the steps of fetching one account from a random file in order.
רמת קושי 3/5 · 200 מטבעות + בונוס קטן בהשלמה הראשונה היום
The key is turned into an initial position and the record there is checked. If its key differs, follow the collision-resolution strategy to find the requested record.
ההשלכות, זה לצד זה
| סדרתי | סדרתי | אקראי | |
|---|---|---|---|
| סדר הרשומות | כנוספו | ממוין לפי מפתח | מחושב מהמפתח |
| הוספת רשומה | מהיר, הצרפה | איטי, הרשומות זזות | מהיר, אם המיקום פנוי |
| מציאת רשומה אחת | איטי, קוראים הכל | מהיר יותר, ניתן לעצור מוקדם | המהיר ביותר, קריאה אחת |
| קריאה בסדר מפתחות | דורש מיון | טבעי | דורש מיון |
- התשובה הנכונה תמיד מבוססת על ה-פעולה הדומיננטית: מה העשייה המרכזית של תוכנה זו?

Sequential file organisation is well suited to processing every record in turn.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Direct access suits looking up a single record.
Match each situation to the file organisation that suits it.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Append only, process everything in order, or look one record up: the dominant operation picks the organisation.
הכרטיס הזה תוקן, לכן הוא מוצג באנגלית עד שהתרגום שלו יעודכן.
Worked example: justify a change
- A library's book file is serial. Searching for one title is slow. Suggest a change and justify it.
- Reorganise as a sequential file ordered by title, so a search can stop when the title is found or passed instead of scanning the whole file.
- If the library also prints a catalogue in title order, a sequential organisation by title serves both reasonably: the catalogue needs no sort and a search can stop early or binary-search 二分查找.
- Name the organisation, name the access method, and tie both to an operation the question mentions.
To produce reports in key order, the best file organisation is:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
A sequential file is already in key order, so reading it sequentially gives an in-order report.
A file organisation is chosen by looking at the program's ____ operation.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Every organisation is fast at something and slow at something else, so the operation done most often decides.
מה שהמפתח חייב להיות, ולמה השחזה שוברת
- גישה ישירה דורשת מפתח, והמפתח חייב להיות ייחודי לרשומה אחת. שם משפחה אינו מפתח; מספר לקוח כן.
- השחזה ממרת את המפתח למיקום רשומה בחישוב אחד, כך שקריאה אחת מגיעה לרשומה ללא קשר לגודל הקובע.
- שני מפתחות שונים יכולים לשחזר לאותו מיקום. זהו תנגשות, ואינו תקלה באלגוריתם: זה בלתי נמנע ברגע שישנם יותר מפתחות אפשריים מאשר מיקומים.
- הפתרון שנכתב בתכנית האומדן הוא אזור עדיפות, או אחסון מצביע במיקום אל שרשרת רשומות שתורשות אותו. תנגשות לכן עולה בקריאה נוספת, ולא באובדן רשומה.
- לכן ההשוואה המוצדקת היא: גיבוי (hashing) מספק גישה קרובה לקבועה עד למילוי הקובץ, וביצועיו מתדרדרים ככל שהעומס מהתנגשויות עולה. גישה רציפה לעולם לא מתדרדרת, אך מעולם לא הייתה מהירה.

Two records hash to the same address. Which are true? Select כולם that apply.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
A collision need not lose a record, but resolving it can require additional reads. Collisions are unavoidable if there are more possible keys than addresses.
סימונים נופלים מהיד
- סדר הוא סדר הגעה; רציף הוא ממוין לפי מפתח. הם אינם סינונימים, והמבחן בודק בדיוק את ההבדל הזה.
- ארגון הוא האופן שבו השטחים מונחים; גישה היא האופן שבו התוכנית מגיעה לשטח אחד. שאלה תכנה אחת או את השנייה.
- קובץ רציף תומך בשתי שיטות הגישה; קובץ סדר תומך רק בגישה רציפה.
- נמקו מהפעולה הדומיננטית, ולא מ"זה מהיר יותר". ציינו מה מהיר, ולמה.
הכרטיס הזה תוקן, לכן הוא מוצג באנגלית עד שהתרגום שלו יעודכן.
You've got it
- serial: order added, append fast, search slow, used for logs · sequential: sorted by a key field, good for batch processing and in-order output · random: initial position computed from the record key, with extra reads possible after collisions
- sequential access 顺序存取 reads from the start; direct access jumps to a position
- sequential access serves serial and sequential files; direct access serves sequential and random files
- choose from the dominant operation: process everything, look one up, or only append
מה השתבש? רק צוות האתר רואה זאת.