4. Computer System Structure
Computer system can be divided into four components:
• Hardware – provides basic computing resources
• CPU, memory, I/O devices
• Operating system
• Controls and coordinates use of hardware among various
applications and users
• Application programs – define the ways in which the system
resources are used to solve the computing problems of the users
• Word processors, compilers, web browsers, database systems,
video games
• Users
• People, machines, other computers
10/1/2022 4
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
5. Computer System
“The one program running at all times on the
computer” is the kernel.
Everything else is either
• a system program (ships with the operating system) ,
or
• an application program.
10/1/2022 5
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
6. Computer Startup
Bootstrap program is loaded at power-up or reboot
• Typically stored in ROM or EPROM, generally
known as firmware
• Initializes all aspects of system
• Loads operating system kernel and starts
execution
10/1/2022 6
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
7. Computer System Organization
Computer-system operation
• One or more CPUs, device controllers connect through
common bus providing access to shared memory
• Concurrent execution of CPUs and devices competing for
memory cycles
10/1/2022 7
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
8. Computer-System Operation
I/O devices and the CPU can execute concurrently
اجهزة
االدخال
واالخراج
والمعالج
يمكن
ان
تنفذ
بالتزامن
Each device controller is in charge of a particular device type
كل
متحكم
مخصص
لنوع
معين
من
االجهزة
Each device controller has a local buffer
كل
متحكم
له
مخزن
داخلي
CPU moves data from/to main memory to/from local buffers
المعالج
ينقل
البيانات
من
والى
الذاكرة
من
والى
المخزن
الداخلي
Device controller informs CPU that it has finished its operation by
causing an interrupt
المتحكم
يعلم
المعالج
بانتهاء
عمله
باستحداث
قاطع
10/1/2022 8
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
9. Common Functions of Interrupts
The occurrence of an event is usually signaled by an interrupt
from either the hardware or the software.
ظهور
حدث
عادة
يشار
اليه
بالمقاطعة
سواء
من
الهاردوير
او
السوفتوير
Hardware may trigger an interrupt at any time by sending a signal
to the CPU, usually by way of the system bus.
قد
تتسبب
األجهزة
في
حدوث
مقاطعة
في
أي
وقت
عن
طريق
إرسال
إشارة
إلى
وحدة
المعالجة
المركزية
،
ً
عادة
عن
طريق
ناقل
النظام
.
Software may trigger an interrupt by executing a special operation
called a system call (also called a monitor call).
قد
يتسبب
البرنامج
في
حدوث
مقاطعة
عن
طريق
تنفيذ
عملية
خاصة
تسمى
ا
ستدعاء
النظام
(
تسمى
اأيض
مكالمة
الشاشة
)
.
10/1/2022 9
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
10. Common Functions of Interrupts
Interrupts are an important part of a computer architecture.
المقاطعات
هي
جزء
مهم
من
معمارية
الكمبيوتر
.
Each computer design has its own interrupt mechanism, but several functions are
common.
كل
تصميم
كمبيوتر
له
آليه
المقاطعة
الخاصة
به
،
ولكن
هناك
العديد
من
الوظائف
الشائعة
.
Interrupt transfers control to the interrupt service routine generally, through the
interrupt vector, which contains the addresses of all the service routines
تنقل
المقاطعة
التحكم
إلى
روتين
خدمة
المقاطعة
بشكل
عام
،
من
خالل
ناقل
المقاطعة
،
الذي
يحتوي
على
عناو
ين
جميع
إجراءات
الخدمة
Interrupt architecture must save the address of the interrupted instruction
يجب
أن
تحفظ
بنية
المقاطعة
عنوان
التعليمات
التي
تمت
مقاطعتها
.
A trap or exception is a software-generated interrupt caused either by an error or a user
request
االعتراض
أو
االستثناء
هو
مقاطعة
ينتج
عن
البرامج
إما
عن
حدوث
خطأ
أو
طلب
مستخدم
An operating system is interrupt driven
نظام
التشغيل
هو
معتمد
على
المقاطعة
10/1/2022 10
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
11. Interrupt Handling
The operating system preserves the state of the
CPU by storing registers and the program counter
يحافظ
نظام
التشغيل
على
حالة
المعالج
من
خالل
تخزين
الس
جالت
وعداد
البرنامج
.
Separate segments of code determine what action
should be taken for each type of interrupt
تعليمات
برمجية
منفصلة
تحدد
اإلجراء
الذي
يجب
اتخاذه
لك
ل
نوع
من
أنواع
المقاطعة
10/1/2022 11
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
14. Storage Structure
Main memory – only large storage media that the CPU can access directly
الذاكرة
الرئيسية
:
وسيط
تخزين
يستطيع
المعالج
الوصول
اليه
مباشرة
• Random access
• Typically volatile
Secondary storage – extension of main memory that provides large nonvolatile storage
capacity
الذاكرة
الثانوية
:
امتداد
للذاكرة
الرئيسية
ولها
سعة
عالية
غير
متطايرة
Hard disks – rigid metal or glass platters covered with magnetic recording material
• Disk surface is logically divided into tracks, which are subdivided into sectors
• The disk controller determines the logical interaction between the device and the
computer
Solid-state disks – faster than hard disks, nonvolatile
• Various technologies
• Becoming more popular
10/1/2022 14
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
15. Storage Hierarchy
Storage systems organized in hierarchy
• Speed
• Cost
• Volatility
Caching – copying information into faster storage
system; main memory can be viewed as a cache for
secondary storage
Device Driver for each device controller to
manage I/O
• Provides uniform interface between controller and kernel
10/1/2022 15
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
20. PC Structure - Memory
10/1/2022 20
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
21. Caching
Important principle, performed at many levels in a computer (in
hardware, operating system, software)
مصطلح
مهم
يوجد
في
اكثر
من
مستوى
في
الكمبيوتر
Information in use copied from slower to faster storage temporarily
المعلومات
المستخدمة
تنسخ
من
التخزين
االبطا
الى
االسرع
موقتا
Faster storage (cache) checked first to determine if information is there
• If it is, information used directly from the cache (fast)
• If not, data copied to cache and used there
Cache smaller than storage being cached
• Cache management important design problem
• Cache size and replacement policy
10/1/2022 21
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
23. Direct Memory Access Structure
Used for high-speed I/O devices able to transmit
information at close to memory speeds
Device controller transfers blocks of data from
buffer storage directly to main memory without
CPU intervention
Only one interrupt is generated per block, rather
than the one interrupt per byte
10/1/2022 23
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
24. A von Neumann architecture
How a Modern Computer Works
10/1/2022 24
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
26. Computer-System Architecture
Most systems use a single general-purpose processor
• Most systems have special-purpose processors as well
Multiprocessors systems growing in use and importance
• Also known as parallel systems, tightly-coupled systems
• Advantages include:
• Increased throughput
• Economy of scale
• Increased reliability – graceful degradation or fault tolerance
• Two types:
• Asymmetric Multiprocessing – each processor is assigned a specific
task.
• Symmetric Multiprocessing – each processor performs all tasks
10/1/2022 26
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
29. Clustered Systems
Like multiprocessor systems, but multiple systems working
together
• Usually sharing storage via a storage-area network (SAN)
• Provides a high-availability service which survives failures
•Asymmetric clustering has one machine in hot-standby
mode
•Symmetric clustering has multiple nodes running
applications, monitoring each other
• Some clusters are for high-performance computing (HPC)
•Applications must be written to use parallelization
10/1/2022 29
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
32. Operating System Structure
Multiprogramming (Batch system) needed for efficiency
• Single user cannot keep CPU and I/O devices busy at all times
• Multiprogramming organizes jobs (code and data) so CPU always has one to
execute
• A subset of total jobs in system is kept in memory
• One job selected and run via job scheduling
• When it has to wait (for I/O for example), OS switches to another job
Timesharing (multitasking) is logical extension in which CPU switches jobs so
frequently that users can interact with each job while it is running, creating
interactive computing
• Response time should be < 1 second
• Each user has at least one program executing in memory process
• If several jobs ready to run at the same time CPU scheduling
• If processes don’t fit in memory, swapping moves them in and out to run
• Virtual memory allows execution of processes not completely in memory
10/1/2022 32
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
33. Operating-System Operations
Interrupt driven (hardware and software)
• Hardware interrupt by one of the devices
مقاطعة
الهاردوير
تكون
بواسطة
احد
االجهزة
• Software interrupt (exception or trap):
• Software error (e.g., division by zero)
اخطاء
البرامج
• Request for operating system service
طلب
خدمة
من
نظام
التشغيل
• Other process problems include infinite loop, processes
modifying each other or the operating system
مشاكل
العمليات
االخرى
المتضمنة
التكرار
الالنهائي
،
تعديالت
العمليات
على
بع
ضها
او
على
نظام
التشغيل
10/1/2022 33
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
34. Operating-System Operations
Dual-mode operation allows OS to protect itself and other system
components.
يتيح
التشغيل
ثنائي
الوضع
لنظام
التشغيل
حماية
نفسه
ومكونات
النظام
األخرى
.
• User mode and kernel mode وضع
المستخدم
ووضع
النواة
.
• Mode bit provided by hardware يتم
توفير
بت
الوضع
بواسطة
األجهزة
• Provides ability to distinguish when system is running user code or
kernel code
يوفر
القدرة
على
التمييز
اذا
كان
النظام
في
طور
تشغيل
كود
المستخدم
أو
كود
النواة
• Some instructions designated as privileged, only executable in
kernel mode
بعض
التعليمات
المصنفة
على
أنها
ذات
امتياز
،
قابلة
للتنفيذ
فقط
في
وضع
النواة
• System call changes mode to kernel, return from call resets it to user
استدعاء
النظام
يغيرالوضع
إلى
النواة
،
والعودة
من
االستدعاء
يعين
الوضع
إلى
المستخدم
10/1/2022 34
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
35. Transition from User to Kernel Mode
Timer to prevent infinite loop / process hogging resources
• Timer is set to interrupt the computer after some time period
ضبط
المؤقت
على
مقاطعة
الكمبيوتر
بعد
فترة
زمنية
.
• Keep a counter that is decremented by the physical clock.
االحتفاظ
بعداد
يتناقص
بواسطة
الساعة
الفعلية
.
• Operating system set the counter.
نظام
التشغيل
يضبط
العداد
• When counter zero generate an interrupt
عندما
يكون
العداد
صفر
يتم
انشاء
المقاطعة
• Set up before scheduling process to regain control or terminate
program that exceeds allotted time
التهيئة
قبل
جدولة
العملية
الستعادة
التحكم
أو
إنهاء
البرنامج
الذي
تجاوز
الوقت
المخص
ص
10/1/2022 35
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
36. Transition from User to Kernel Mode
10/1/2022 36
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
38. Process Management
A process is a program in execution. It is a unit of work within the system.
Program is a passive entity, process is an active entity.
العملية
عبارة
عن
برنامج
قيد
التنفيذ
.
إنها
وحدة
عمل
داخل
النظام
،
البرنامج
كيان
غير
فعال
،
والعملية
كيان
نشط
.
Process needs resources to accomplish its task
• CPU, memory, I/O, files
• Initialization data
Process termination requires reclaim of any reusable resources
يتطلب
إنهاء
العملية
استعادة
أي
موارد
قابلة
إلعادة
االستخدام
Single-threaded process has one program counter specifying location of
next instruction to execute
تحتوي
العملية
أحادية
الخيوط
على
عداد
برنامج
واحد
يحدد
موقع
التعليمات
التالية
للتنف
يذ
• Process executes instructions sequentially, one at a time, until
completion
تنفذ
العملية
التعليمات
بالتتابع
،
اواحد
تلو
اآلخر
،
حتى
اكتمالها
10/1/2022 38
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
39. Process Management
Multi-threaded process has one program counter per thread
تحتوي
العملية
متعددة
الخيوط
على
عداد
برنامج
واحد
لكل
خيط
Typically system has many processes, some user, some operating system running
concurrently on one or more CPUs
ً
عادة
ما
يحتوي
النظام
على
العديد
من
العمليات
،
بعضها
للمستخدم
،
وبعضها
لنظام
التشغيل
تعمل
ب
شكل
متزامن
في
معالج
واحد
أو
أكثر
• Concurrency by multiplexing the CPUs among the processes / threads
التزامن
عن
طريق
تنقل
المعالج
بين
العمليات
/
الخيوط
The operating system is responsible for the following activities in connection
with process management:
• Creating and deleting both user and system processes انشاء
او
حذف
العمليات
• Suspending and resuming processes تعليق
واستئناف
العمليات
• Providing mechanisms for process synchronization توفير
آليات
لمزامنة
العملية
• Providing mechanisms for process communication توفير
آليات
لعملية
االتصال
• Providing mechanisms for deadlock handling توفير
آليات
للتعامل
مع
الطريق
المسدود
10/1/2022 39
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
40. Memory Management
To execute a program all (or part) of the instructions must be in memory
لتنفيذ
برنامج
،
يجب
أن
تكون
جميع
التعليمات
(
أو
جزء
منها
)
في
الذاكرة
.
All (or part) of the data that is needed by the program must be in memory.
يجب
أن
تكون
جميع
(
أو
جزء
)
البيانات
التي
يحتاجها
البرنامج
في
الذاكرة
.
Memory management determines what is in memory and when
تحدد
إدارة
الذاكرة
ما
هو
موجود
في
الذاكرة
ومتى
• Optimizing CPU utilization and computer response to users
تحسين
استخدام
وحدة
المعالجة
المركزية
واستجابة
الكمبيوتر
للمستخدمين
Memory management activities
• Keeping track of which parts of memory are currently being used and by whom
تتبع
أي
أجزاء
من
الذاكرة
يتم
استخدامها
احالي
ومن
قبل
من
• Deciding which processes (or parts thereof) and data to move into and out of memory
تحديد
العمليات
(
أو
أجزاء
منها
)
والبيانات
التي
سيتم
نقلها
إلى
الذاكرة
وخارجها
• Allocating and deallocating memory space as needed
تخصيص
مساحة
الذاكرة
وإلغاء
تخصيصها
حسب
الحاجة
10/1/2022 40
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
41. Storage Management
OS provides uniform, logical view of information storage
يوفر
نظام
التشغيل
رؤية
موحدة
ومنطقية
لتخزين
المعلومات
• Abstracts physical properties to logical storage unit - file
يلخص
الخصائص
الفيزيائية
لوحدة
التخزين
المنطقية
-
الملف
• Each medium is controlled by device (i.e., disk drive, tape
drive)
يتم
التحكم
في
كل
وسيط
بواسطة
جهاز
(
أي
محرك
األقراص
ومحرك
الشريط
)
•Varying properties include access speed, capacity, data-
transfer rate, access method (sequential or random)
تشمل
الخصائص
المتغيرة
سرعة
الوصول
،
والسعة
،
ومعدل
نقل
البيانا
ت
،
وطريقة
الوصول
(
تسلسلي
أو
عشوائي
)
10/1/2022 41
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
42. Storage Management
File-System management
• Files usually organized into directories
عادة
ما
يتم
تنظيم
الملفات
في
أدلة
• Access control on most systems to determine who can access what
التحكم
في
الوصول
إلى
معظم
األنظمة
لتحديد
من
يمكنه
الوصول
إلى
ماذا
• OS activities include
• Creating and deleting files and directories
إنشاء
وحذف
الملفات
واألدلة
• Primitives to manipulate files and directories
األساسيات
لمعالجة
الملفات
واألدلة
• Mapping files onto secondary storage
تعيين
الملفات
على
التخزين
الثانوي
• Backup files onto stable (non-volatile) storage media
النسخ
االحتياطي
للملفات
على
وسائط
تخزين
مستقرة
(
غير
متطايرة
)
10/1/2022 42
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
43. Mass-Storage Management
Usually disks used to store data that does not fit in main memory or data that must be kept for a
“long” period of time
عادة
األقراص
المستخدمة
لتخزين
البيانات
التي
تتسع
في
الذاكرة
الرئيسية
أو
البيانات
التي
يجب
االحتفاظ
بها
لف
ترة
"
طويلة
"
من
الوقت
Proper management is of central importance
اإلدارة
السليمة
لها
أهمية
مركزية
OS activities
• Free-space management
إدارة
المساحة
الخالية
• Storage allocation
تخصيص
التخزين
• Disk scheduling
جدولة
القرص
• Partitioning
التجزئة
• Protection
الحماية
10/1/2022 43
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
44. I/O Subsystem
One purpose of OS is to hide peculiarities of hardware devices from the
user
يتمثل
أحد
أهداف
نظام
التشغيل
في
إخفاء
خصائص
األجهزة
عن
المستخدم
I/O subsystem responsible for
• Memory management of I/O including buffering (storing data
temporarily while it is being transferred), caching (storing parts of
data in faster storage for performance), spooling (the overlapping of
output of one job with input of other jobs)
ادارة
الذاكرة
لإلدخال
واالخراج
تتضمن
التخزين
المؤقت
،
الذاكرة
المخبأة
،
المسالك
• General device-driver interface
واجهة
برنامج
تشغيل
الجهاز
العامة
• Drivers for specific hardware devices
التعريفات
ألجهزة
معينة
10/1/2022 44
OPERATING SYSTEMS– AL-NASSER UNIVERSITY
45. Protection and Security
Protection – any mechanism for controlling access of processes or users to resources
defined by the OS
الحماية
–
هي
أي
آلية
للتحكم
في
وصول
العمليات
أو
المستخدمين
إلى
الموارد
المحددة
بواسطة
نظام
التشغيل
Security – defense of the system against internal and external attacks
األمن
-
الدفاع
عن
النظام
ضد
الهجمات
الداخلية
والخارجية
Systems generally first distinguish among users, to determine who can do what
• User identities (user IDs, security IDs) include name and associated number, one
per user
تتضمن
هويات
المستخدم
(
معرفات
المستخدم
ومعرفات
األمان
)
االسم
والرقم
المرتبط
به
،
واحد
لكل
مس
تخدم
• User ID then associated with all files, processes of that user to determine access
control
ثم
يتم
ربط
معرف
المستخدم
بجميع
الملفات
،
وعمليات
ذلك
المستخدم
لتحديد
التحكم
في
الوصول
• Group identifier (group ID) allows set of users to be defined and controls managed,
then also associated with each process, file
يسمح
معرف
المجموعة
(
معرف
المجموعة
)
بتحديد
مجموعة
من
المستخدمين
وإدارة
عناصر
التحكم
،
ثم
ربط
ها
اأيض
بكل
عملية
أو
ملف
10/1/2022 45
OPERATING SYSTEMS– AL-NASSER UNIVERSITY