برمجه نظم _ المحاضره الأولى
DESCRIPTION
سلسله محاضرات يقدمها الدكتور احمد الحربي لطلاب الجامعه السنه رابع حاسبTRANSCRIPT
برمجة النظم
رابعة حاسب محاضرة (١)
دآتور/ أحمد الحربي
- This course has two major objectives: to teach procedures for the
design of software systems and to provide a basis for judgment in
the design of software.
- Machine structure and the basic tasks of an operating system can be
given by the following diagram:
People Application programming
Macro ProcessorsAssemblersCompilers Loaders Text editors Debugging aids Searching and sorting
I/O programs
File systems
Scheduler Libraries Memory management
Device management
Figure 1.1 Foundations of system programming
Machine Structure
Figure 1.2 shows the general hardware organization of a computer
system.
1
- Memory is the device where information is stored.
- Processors are the devices that operate on this information.
يسمى 0 أو 1وآل من )ones & zeros( تحفظ في شكل informationوآما تعرفون أن
binary digit ويحفظ في وحدة تسمى bit وهذه bits تجمع في unitsتسمى :
Words, characters, or bytes.
,byte( يحدد للـ address وآل addressـ تحدد بMemory Locationsحيث أن
word, character.(
2
- The contents of a word may be interpreted as data (values to be
operated on) or instructions (operations to be performed).
- A processor is a device that performs a sequence of operations
specified by instructions memory.
- Information in memory is coded into groups of bits that may be
interpreted as characters, instructions, or numbers.
- A code is a set of rules for interpreting groups of bits, e.g., codes
for representation of decimal digits (BCD), for characters
(EBCDIC, or ASCII), or for instructions (specific processor
operation codes).
- The I/O processors are concerned with the transfer of data between
memory and peripheral such as disks, drams, CD-ROMs, printers,
and typewriters.
- The CPUs are concerned with manipulations of data stored in
memory.
: سوف نقوم بدراسة آل منcourseخالل هذا
Assemblers, Macros, Loaders, and Compilers
. لهمapplicationsبالتفصيل وآذلك عمل
3
.programming system األساسية للـ componentsآل ذلك هو عبارة عن
• Assemblers:
They are programs aim to translate assembly language into machine
language.
Machine Language Translation or (Object Program)
Assembler
Assembly Program Or (Source Program)
• Loaders:
فان هذا البرنامج يوضع في الذاآرة وينفذ object program ينتج assemblerبمجرد أن
أيضًا المبرمج يجب أن يحول برنامجه آما سبق مع آل . في الذاآرةassemblerمع ترك
.قتًا طويًالمرة تنفيذ، وهذا يأخذ و
آخرى تسمى componentولحل مشكلة إطالة الوقت، فان مبرمجي النظم طورو
Loader.
- A loader is a program that places programs into memory and
prepares them for execution.
: هماSubroutinesيوجد نوعين من
Closed and open Subroutines.
4
- An open subroutine or “macro definition” is one whose code is
inserted into the main program (flow continuous).
تم مناداته أربع مرات فإنه يجب أن يظهر في أربع ) open Subroutine(لو نفس لذلك
مختلفة في البرنامج الرئيسي،أماآن
- closed subroutineيوجد مع هذا النوع من ، يمكن أن يخزن خارج البرنامج الرئيسي
:البرامج الفراعية مطلبين هما
البرنامج الرئيسي يجب أن ينفذ، -
closedحيث أن ) control and transfer of data(والثاني يجب نقل للـ -
subroutineيجب أن بحمل بالذاآرة في عنوان خاص .
• Relocating loaders perform four functions:
1- Allocate space in memory for the programs (allocation).
2- Resolve symbolic references between object decks (linking).
3- Adjust all address-dependent locations, such as address constants
with the allocated space (relocation).
4- Physically place the machine instructions and data into memory
(loading).
5
Macros
The macro processor treats the identical parts of the program
defined by the abbreviation as a macro definition and saves the
definition.
After that, the macro processor substitutes the definition for all
occurrences of the abbreviation (macro call) in the program.
Compilers
A compiler is a program that accepts a program written in a high
level language and produces an object program.
An interpreter is a program that appears to execute a source
program as if it was machine language.
Machine Structure
- The CPU consists of an instruction interpreter, a location counter,
an instruction register and various working registers and general
registers.
6
- The instruction interpreter is a group of electrical circuits (H.W.)
that perform the intent of instruction fetched from memory.
- The Location Counter (LC), also called Program Counter (PC) or
Instruction Counter (IC), is a hardware memory device which
denotes the location of the current instruction being executed.
- A copy of the current instruction is stored in the instruction register
(IR).
- The Memory Address Register (MAR) contains the address of the
memory location that is to be read from or stored into.
- The Memory Buffer Register (MBR) contains a copy of the
designated memory location specified by the MAR after a “read”
or the new contents of the memory location prior to a “write”.
- The memory controller is hardware that transfers data between the
MBR and the core memory location the address of which is in the
MAR.
- The I/O channels may be thought of as separate computers which
interpret special instructions for inputting and outputting
information from the memory.
7
.تعمل) machine structure(لشرح آيف أن هذه المكونات للـ
عامة وهم بالنظام registersيملك أربعة ) SC-6251(على سبيل المثال الكمبيوتر نوع
بالشكل ) basic instruction(، حيث تكون )and 11 ,10 ,01 ,00(الثنائي آما يلي
:التالي
Memory Location
Register Number
Operation Code
(op) (reg) (addr)
For example, the instruction:
ADD 2, 178
Memory Location ( 178( المحفوظة في Dataإضافة
).general register 2(إلى محتوى
).Register 2(ونتيجة الجمع سوف تحفظ آقيمة جديدة للـ
Figure 2.1 يوضح )General machine structure (لمكاينة نوعها
(IBM system 1360).
- I/O channel تستخدم إلدخال المعلومات أو طبعها من memory.
- Memory controller هو الذي يقوم بنقل المعلومة بين MAR, MBR.
8
- MAR تحتوي على العنوان للـ memory locationلتقرأ منه أو يخزن إليه .
- MBR تأخذ نسخة MAR بعد القراءة أو المحتويات الجديدة للـ ML عشان تجهيزهم
.لكتابة
- LC يكون وحدة من Mالتي تشير إلى مكان معلومة .
- IRيخزن به نسخة من المعلومة العامة .
- Instruction interpreter عبارة عن مجموعة من الدوائر الكهربية )H.W..(
Figure 2.2 يشرح الخطوات للـ )hardware operations ( المكونة داخل)the
instruction interpreter ( لتنفيذan instruction.
• MAR<= IC: - instruction counter يحدد location للـ current instruction
.MARفي
• IR<= MAR:- يضع instruction من MAR في IR.
.الباقي واضح •
9
10
11