Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet253/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

X
Y
X AND Y
X OR Y
X XOR Y
X
NOT X
0
0
0
0
0
0
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
0
0
AND 0
0
1
0
0
1
1
1
1
0
0
1
1
1
1
0
0
1
1
1
0
1
0
FIGURE A.1 
Demonstration of pair-wise AND operation.


646

Appendix
If you think that the network address then is merely the first two octets, you may not be 
correct. Using the same netmask on this IP address 128.58.221.39 gives us a very different 
network address:
255.255.240.0 
=
11111111.11111111.11110000.00000000
128.58.221.39 
=
10000000.00111010.11011101.00100111
ANDing these two numbers 
=
10000000.00111010.11010000.00000000 
=
128.58.208.0.
To obtain the computer’s address, we can NOT the netmask and AND the result to the 
IP address. NOT 255.255.240.0 
=
NOT 11111111.11111111.11110000.00000000 
=
00000000
.00000000.00001111.11111111.
00000000.00000000.00001111.11111111
AND 00001010.00001011.00001100.00001101
00000000.00000000.00001100.00001101 
=
0.0.12.13
00000000.00000000.00001111.11111111
AND 10000000.00111010.11011101.00100111
00000000.00000000.00001101.00100111 = 0.0.13.39
If you are not dealing with either programming or network addressing, you may never 
need to apply Boolean logic.
We mentioned the use of parity earlier with respect to ASCII. Parity is a simple means 
of performing error checking. As bits of data move around the computer, through storage, 
and across computer networks, it is possible that some data become corrupt. For instance, 
imagine that we are storing 11110110 and send it from component A to component B in 
the computer. It arrives as 11010110. This could lead to an incorrectly executed program, 
a run-time error or worse. We can add a simple error checking mechanism to discover if 
such a byte contains an error. We do this by adding a parity bit to each byte. The parity bit 
encodes whether the byte has even or odd parity. In even parity, the total number of 1 bits 
in a value is even. In odd parity, the total number of 1 bits in a value is odd.
Let us assume we want to use even parity. Since the value 11110110 has 6 1-bits and 2 
0-bits, it has even parity. To add a parity bit to this byte, we need to maintain even parity. 
We do this by adding a parity bit of 0. Now, the parity bit plus byte is 0 11110110, which still 
has even parity. Upon receiving this information, if the component receives 0 11010110, 
there is obviously some error because this parity bit plus byte has odd parity (5 1-bits).
In ASCII, we can add the parity bit to the byte itself to make use of the 8th bit. 
Alternatively, we can compute and tack on the parity bit whenever we want to move a byte 
of information around the computer. If our computer implements even parity, then an 
error is known to have arisen whenever we have an odd number of 1 bits when we combine 
the parity bit and the byte. Some computers use odd parity instead of even parity, in which 
case the number of 1 bits should always be an odd number.
Note that with the parity bit, we can detect an error but we cannot resolve what bit is 
wrong. It might be the case that one of the 8 bits in the byte is wrong, but it could also be 


Appendix

647
the parity bit that is wrong. For instance, if we have the byte 10101110, we would add a 
parity bit of 1. If some component receives 10101110 and a parity bit of 0, it is actually the 
parity bit that is erroneous, but we cannot determine this from the 9 bits. The solution is to 
just ask the sending component to resend the 9 bits. What if two errors arise in the same 9 
bits? The single parity bit cannot resolve this problem. But it is very unlikely to have a single 
error let alone two so we do not concern ourselves with this possibility.
Parity is computed using XOR. Given a byte, XOR the 8 bits together. You might remem-
ber that XOR only operates on two bits. Thus, we have to cascade the XOR operations 
together. Returning to our previous example of 10101110, we XOR each pair of bits as 
shown in Figure A.2.
We see in the figure that each pair of bits are XORed together. The first two are 1 and 0, 
or 1 XOR 0 
=
1. This is the same for the next two bits (and the last two bits). The fifth and 
sixth bits are 1 and 1 giving us 1 XOR 1 
=
0. Now, we take the four resulting bits and XOR 
them in pairs, or 1 XOR 1 
=
0 and 0 XOR 1 
=
1. Finally, we XOR these resulting bits giving 
us 0 XOR 1 
=
1. Thus, the parity bit for 10101110 is 1. We confirm this by counting the total 
number of 1 bits in the byte plus parity bit, 6, an even number. To compute odd parity, use 
the exact same process but NOT the result.
Parity is also used in RAID technology to compute redundancy information. We briefly 
discuss RAID technology in Chapter 10 but go over it in more detail in Chapter 14 where 
we return to this idea of parity computations.
A.6 CHAPTER REVIEW
Concepts introduced in the appendix:
• ASCII—common character representation using 7 bits. Superseded by Unicode.
• Binary—numbering representation using two digits, 0 and 1. Nearly all computers 
store information in binary.
• Bit—a single binary digit storing a 0 or a 1.
• Bitmap—a common representation for images where each pixel is individually 
represented.
• Boolean operator—one of four operations applied to binary bits, AND, OR, NOT, 
XOR. Computer hardware operates using these operators.
101011110 has a parity bit of 1
1 XOR 0 = 1
1
0
1
0
1
1
1
0
1 XOR 1 = 0
0 XOR 1 = 1
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 0 = 0
1 XOR 0 = 1
FIGURE A.2 
Computing the parity bit using XOR operations.


648

Appendix
• Byte–8 bits combined together for a larger unit of storage.
• Decimal—the base 10 numbering system, used by people.
• Frame rate—the number of images displayed per second in video. A sufficiently high 
rate must be used to trick the human eye into thinking the images are moving.
• G—abbreviation for a giga, 2
30
, or about 1 billion.
• Hexadecimal—the base 16 numbering system, primarily used to combine binary bits 
for easier examination. IP version 6 addresses are stored in hexadecimal.
• K—abbreviation for a kilo, 2
10
, or about 1 thousand (1024 precisely).
• M—abbreviation for a mega (or meg), 2
20
, or about 1 million.
• Netmask—a 32-bit number (4 octets) that, when ANDed with an IP address, provides 
the computer’s network address.
• Octal—the base 8 numbering system, sometimes used to simplify binary numbers.
• Parity—a means of determining an error in the transmission of binary data by deter-
mining whether the number of 1 bits in a number is even or odd.
• Pixel—a single point or dot of an image stored by computer.
• Powers of 2—the values of 2 raised to an integer value such as 2
0
=
1, 2
1
=
2, 2
2
=
4, 
2
3
=
8, and 2
4
=
16.
• T—abbreviation for a tera, 2
40
, or about 1 trillion.
• Unicode—expansion of the ASCII character representation to 16 bits so that we can 
encode characters of many languages and other useful symbols.
• Word—the typical data storage size for a computer. Modern computers have a 32- or 
64-bit word size.
REVIEW QUESTIONS
1. Compute 2
25
.
2. Compute 2
37
.
3. Compute 2
51
.
4. What range of numbers, starting at 0, can be stored in 8 bits? In 10 bits? In 14 bits? In 
24 bits?
5. Extend Table A.1 by computing 2
12
through 2
16
.
For questions 6–17, convert the given binary numbers to decimal. The 
2
subscripts are 
omitted.


Appendix

649
6. 00000111
7. 01001001
8. 11110000
9. 10101010
10. 00110011
11. 10111101
12. 0000000000110011
13. 0000000100000000
14. 0011001100110011
15. 1001001010000101
16. 1111111100000000
17. 1111111111111111
For questions 18–24, convert the given decimal values to 8-bit binary values. Use the 
division approach.
18. 45
19. 61
20. 99
21. 115
22. 180
23. 200
24. 241
For questions 25–31, convert the given decimal values to 8-bit binary values. Use the 
subtraction approach.
25. 40
26. 51
27. 89
28. 121
29. 194
30. 221
31. 250


650

Appendix
For questions 32–36, convert the given decimal values to 16-bit binary values. Use the 
division approach.
32. 4985
33. 6613
34. 12345
35. 23456
36. 34567
For questions 37–41, convert the given decimal values to 16-bit binary values. Use the 
subtraction approach.
37. 2000
38. 7811
39. 13343
40. 33333
41. 60000
For questions 42–48, convert the given binary number to octal and to hexadecimal.
42. 11110000
43. 10101010
44. 11000101
45. 1110011110
46. 10000101001011
47. 1001110101011110
48. 1111101111010100
49. Assume a book comprises 500 pages of text where each page contains 1000 charac-
ters. If we were to store this book using Unicode, approximately how large would the 
file’s size be?
50. We encode the color of an RGB pixel using 3 bytes, one for each of the amount of 
red, the amount of green, and the amount of blue. This gives us the ability to store 
16,777,216 colors for each pixel. Explain where the number 16,777,216 came from.
We often encode the RGB values using hexadecimal notation. For instance, full Red, 
no Green, and full Blue would be FF00FF where FF is the hexadecimal equivalent to the 
decimal value 255. This would be the color purple (all red and all blue and no green). Given 


Appendix

651
this description, explain what color each of the following hexadecimal values represents 
for questions 51–56.
51. 00FF00
52. 000000
53. 00FFFF
54. 0000FF
55. 8888FF
56. FFFFFF
57. If our IP address is 153.47.138.201 and our netmask is 255.255.240.0, what is our net-
work address?
58. If our IP address is 153.47.138.201 and our netmask is 255.224.0.0, what is our net-
work address?
59. If our IP address is 192.14.243.1 and our netmask is 255.255.240.0, what is our com-
puter’s address on the network?
60. If our IP address is 192.14.243.1 and our netmask is 255.255.192.0, what is our net-
work address?
For questions 61–69, compute each of given Boolean operations.
61. 11110000 AND 11001100
62. 11110000 OR 11001100
63. 11110000 XOR 11001100
64. NOT 00110000
65. 11000011 AND 10101010
66. 11000011 OR 10101010
67. 11000011 XOR 10101010
68. (NOT 11110000) AND (NOT 11001100)
69. (NOT 11000011) XOR 10101111
For questions 70–73, compute the parity bit assuming even parity.
70. 10101010
71. 11110001
72. 00000000
73. 01011011


652

Appendix
For questions 74–77, state whether there is an error in the parity bit 
+
byte assuming 
even parity.
74. 0, 00001111
75. 1, 00111101
76. 1, 01010110
77. 0, 00000000


K23087
LINUX
with Operating 
System Concepts
LINUX
with Operating 
System Concepts
Richard Fox
Fox
“I would strongly recommend this book as a primary textbook for a course or 
tutorial on the use of Linux or as a companion reference book in an operating 
systems (OS) course. This is also a great book for business computer systems 
students, IT personnel who need to jump onto the Linux/Unix wagon, or for an 
engineer or engineering student who wants to learn more about a workstation that 
hosts his or her computer-aided design software.”
—Aleksander Malinowski, Bradley University
“This book is a broad and deep look at everything you need to do to dive into 
Linux. Both experienced users and Linux newbies will have something to learn 
from this book; it’s worthy of keeping on your shelf as a reference.”
—Peter Bartoli, San Diego State University
“This is a good book that covers a comprehensive list of Linux topics for college 
students. Unlike many Linux books that are written for system administrators or 
software professionals who develop Linux systems or applications, this book 
takes a unique approach and discusses the topics at a level that is appropriate for 
undergraduate students who are learning Linux.”
—Xiannong Meng, Bucknell University

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