Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet252/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   246   247   248   249   250   251   252   253   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

Storage in Bytes
Abbreviation
Equivalent Compressed Image/Video
1
1 byte
Nothing
1024 (2
10
)
1 kilobyte
A 32 
×
32 color image
1 million (2
20
)
1 megabyte
A 1000 
×
1000 color image
1 billion (2
30
)
1 gigabyte
2½ hours of compressed video, or ¼ of a movie on DVD
1 trillion (2
40
)
1 terabyte
250–1000 movies (depending on the quality)


644

Appendix
• DRAM (main memory): usually 8 gigabytes but as much as 32 gigabytes for desktop 
and laptop computers, 1 terabyte or more for mainframe and supercomputers, under 
4 gigabytes for handheld devices.
The storage devices consist of hard disk drives, flash drives, optical disks, and magnetic 
tape. In order of smallest to largest capacity, we have the following:
• Flash memory: 1–256 gigabytes, usually in the range of 2–8 gigabytes.
• Optical disk: 750 megabytes up to 8 gigabytes for DVD and up to 128 gigabytes for 
Blu Ray.
• Hard disk: internal hard disk drives typically are between 500 gigabytes and 1 tera-
byte, external hard disk drives can have up to 3 terabytes.
• Magnetic tape: up to 5 terabytes.
A.5 BOOLEAN LOGIC
*
The computer operates by applying Boolean operations on bits. The Boolean operators are 
AND, OR, NOT, and XOR. We do not typically think at such a low level and instead view 
data using more abstract operations such as addition, multiplication, and comparison. Yet 
it is still worth learning the Boolean operators as you will need to understand logic when 
writing your own code (see, for instance, the use of &&, ||, and ! from Chapter 7). You also 
need to understand the use of AND to apply a netmask (covered in Chapter 12). So here we 
look at these four Boolean operators.
We apply AND, OR, and XOR on two bits. The NOT operator is applied to a single bit. 
Before we go through some examples, let us formally define the four operators.
• AND—outputs 1 if both of the two inputs are 1, otherwise outputs 0.
• OR—outputs 1 if either of the two inputs are 1, otherwise outputs 0.
• XOR—outputs 1 if the two inputs differ, otherwise outputs 0.
• NOT—outputs 1 if the input is 0, otherwise outputs 0. We could also define NOT as 
flipping the bit (0 becomes 1, 1 becomes 0).
Table A.8 provides the truth tables for these four operators. The truth table shows all 
possible combinations of inputs and their outputs. With two bits, for instance, we might 
have 1 OR 0 
=
1 or 1 AND 0 
=
0. NOT only applies to one bit, for instance, NOT 1 
=
0.
As we discussed in Section A.1, having single bit storage is not very useful, so we group 
storage cells together. Similarly, performing Boolean operations on single bits is also not 
*
In this section, we omit the subscript 2 after any binary number. Assume all numbers in this section are written in 
binary.


Appendix

645
particularly useful. Our Boolean operators are applied pair-wise so that given two binary 
values we apply the operator to each corresponding pair of bits of the two numbers. Thus, 
we apply AND on the leftmost two bits of the numbers, then the two bits of the next column 
and so forth. This is shown in Figure A.1 where we apply AND on the two bytes 00111111 
and 01010101.
What follows are the pair-wise application of OR and XOR on the same two binary 
numbers.
0 0 1 1 1 1 1 1 
0 0 1 1 1 1 1 1
OR 
0 1 0 1 0 1 0 1
XOR 
0 1 0 1 0 1 0 1
0 1 1 1 1 1 1 1 
0 1 1 0 1 0 1 0
The NOT operator only applies on a single binary number. This operation can be thought 
of as flipping each bit (0 becomes 1, 1 becomes 0). For instance, NOT 00111111 
=
11000000 
and NOT 01011010 
=
10100101.
Let us put this into practice. In Chapter 12, we learn about the 
netmask
. Given a com-
puter’s IP address and its netmask, we can determine the network address for the computer. 
The IP address encapsulates two pieces of information, the computer’s network address 
and the computer’s address within that network. Assume our computer’s IP address is 
10.11.12.13. If we have a netmask of 255.255.240.0, we can apply AND to obtain the net-
work’s computer address.
First, we must convert each of these octets from decimal to binary. Then, we apply AND. 
The resulting binary number can be converted back to decimal to obtain the network 
address.
255.255.240.0 
=
11111111.11111111.11110000.00000000
10.11.12.13 
=
00001010.00001011.00001100.00001101
ANDing the two numbers 
=
00001010.00001011.00000000.00000000 
=
10.11.0.0. This 
tells us our network address is 10.11.0.0.
TABLE A.8 
Truth Table for Boolean Operators

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   246   247   248   249   250   251   252   253   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish