Sunteți pe pagina 1din 11

‫ﺑﺮﻣﺠﺔ اﻟﻨﻈﻢ‬

(١) ‫ﻣﺤﺎﺿﺮة‬ ‫راﺑﻌﺔ ﺣﺎﺳﺐ‬

‫ أﺣﻤﺪ اﻟﺤﺮﺑﻲ‬/‫دآﺘﻮر‬

- 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
Compilers Assemblers Macro Processors
Loaders Text editors Debugging aids Searching and sorting
I/O File Scheduler Libraries Memory Device
programs systems management 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 ‫وآﻤﺎ ﺗﻌﺮﻓﻮن أن‬

:‫ ﺗﺴﻤﻰ‬units ‫ ﺗﺠﻤﻊ ﻓﻲ‬bits ‫ وهﺬﻩ‬bit ‫ وﻳﺤﻔﻆ ﻓﻲ وﺣﺪة ﺗﺴﻤﻰ‬binary digit

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.

Assembly Program Machine Language


Or Assembler Translation or
(Source Program) (Object 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) ‫ ﺣﻴﺚ ﺗﻜﻮن‬،(00, 01, 10, and 11) ‫اﻟﺜﻨﺎﺋﻲ آﻤﺎ ﻳﻠﻲ‬

:‫اﻟﺘﺎﻟﻲ‬

Operation Register Memory


Code Number Location

(op) (reg) (addr)

For example, the instruction:

ADD 2, 178

178 Å (Memory Location) ‫ اﻟﻤﺤﻔﻮﻇﺔ ﻓﻲ‬Data ‫إﺿﺎﻓﺔ‬

.(general register 2) ‫إﻟﻰ ﻣﺤﺘﻮى‬

.(Register 2) ‫وﻧﺘﻴﺠﺔ اﻟﺠﻤﻊ ﺳﻮف ﺗﺤﻔﻆ آﻘﻴﻤﺔ ﺟﺪﻳﺪة ﻟﻠـ‬

‫( ﻟﻤﻜﺎﻳﻨﺔ ﻧﻮﻋﻬﺎ‬General machine structure) ‫ ﻳﻮﺿﺢ‬Figure 2.1

.(IBM system 1360)

.memory ‫ ﺗﺴﺘﺨﺪم ﻹدﺧﺎل اﻟﻤﻌﻠﻮﻣﺎت أو ﻃﺒﻌﻬﺎ ﻣﻦ‬I/O channel -

.MAR, MBR ‫ هﻮ اﻟﺬي ﻳﻘﻮم ﺑﻨﻘﻞ اﻟﻤﻌﻠﻮﻣﺔ ﺑﻴﻦ‬Memory controller -

8
‫‪ MAR -‬ﺗﺤﺘﻮي ﻋﻠﻰ اﻟﻌﻨﻮان ﻟﻠـ ‪ memory location‬ﻟﺘﻘﺮأ ﻣﻨﻪ أو ﻳﺨﺰن إﻟﻴﻪ‪.‬‬

‫‪ MBR -‬ﺗﺄﺧﺬ ﻧﺴﺨﺔ ‪ MAR‬ﺑﻌﺪ اﻟﻘﺮاءة أو اﻟﻤﺤﺘﻮﻳﺎت اﻟﺠﺪﻳﺪة ﻟﻠـ ‪ ML‬ﻋﺸﺎن ﺗﺠﻬﻴﺰهﻢ‬

‫ﻟﻜﺘﺎﺑﺔ‪.‬‬

‫‪ LC -‬ﻳﻜﻮن وﺣﺪة ﻣﻦ ‪ M‬اﻟﺘﻲ ﺗﺸﻴﺮ إﻟﻰ ﻣﻜﺎن ﻣﻌﻠﻮﻣﺔ‪.‬‬

‫‪ IR -‬ﻳﺨﺰن ﺑﻪ ﻧﺴﺨﺔ ﻣﻦ اﻟﻤﻌﻠﻮﻣﺔ اﻟﻌﺎﻣﺔ‪.‬‬

‫‪ Instruction interpreter -‬ﻋﺒﺎرة ﻋﻦ ﻣﺠﻤﻮﻋﺔ ﻣﻦ اﻟﺪواﺋﺮ اﻟﻜﻬﺮﺑﻴﺔ )‪.(H.W.‬‬

‫‪ Figure 2.2‬ﻳﺸﺮح اﻟﺨﻄﻮات ﻟﻠـ )‪ (hardware operations‬اﻟﻤﻜﻮﻧﺔ داﺧﻞ ) ‪the‬‬

‫‪ (instruction interpreter‬ﻟﺘﻨﻔﻴﺬ ‪.an instruction‬‬

‫• ‪ instruction counter -: MAR<= IC‬ﻳﺤﺪد ‪ location‬ﻟﻠـ ‪current instruction‬‬

‫ﻓﻲ ‪.MAR‬‬

‫• ‪ -:IR<= MAR‬ﻳﻀﻊ ‪ instruction‬ﻣﻦ ‪ MAR‬ﻓﻲ ‪.IR‬‬

‫• اﻟﺒﺎﻗﻲ واﺿﺢ‪.‬‬

‫‪9‬‬
10
11

S-ar putea să vă placă și