second edition introduction to computing systems from bits and gates to C and beyond. Yale N. Patt. The University of Texas at Austin. Sanjay J. Patel. University. Introduction to Computing Systems: From Bits and Gates to C and Beyond. 2nd Edition. Yale N. Patt. Sanjay J. Patel .. folatpanelche.ml Spend 1 hour on it. Access Introduction to Computing Systems 2nd Edition. Sanjay J. Patel, Yale N. Patt. using Chegg Study. Unlike static PDF Introduction To.
|Language:||English, Spanish, Dutch|
|Distribution:||Free* [*Sign up for free]|
ece/jl/hwAndExtras/Yale Patt, Sanjay Patel-Introduction to Computing Systems_ From bits and gates to C and beyond-McGraw-Hill ().pdf. Find file Copy. Engineering) By Yale N. Patt, Sanjay J. Patel [PDF EBOOK EPUB Review Introduction To Computing Systems: From Bits & Gates To C. Patt, Sanjay J. Patel pdf download. Introduction To Computing Systems: From Bits & Gates To C &. Beyond: From Bits And Gates To C And.
We then. We will further see how those transistors are combined into larger structures that perform operations. Or the Pentium IV. We include many aspects of C that are usually not dealt with in an introductory textbook. We will encode all information as sequences of Os and Is. Every wire in the computer. TRAPs and subroutines. LC-3 stands for Little Computer 3. Once we are comfortable with information represented as codes made up of 0s and Is and operations addition. In Chapter 5.
In Chapter 4. We do not differentiate exactly how high. In the second half of the book Chapters We will see how to perform operations on such encoded information. When we get in a taxi and tell the driver. Our ability to abstract is very much a productivity enhancer.
We conclude our introduction to C by examining two very common high-level constructs. It allows us to not get bogged down in the detail when everything about the detail is working just fine. At the time I was living in Palo Alto. It is hard to think of any body of knowledge where the notion of abstraction is not central. The two themes are a the notion of abstraction and b the importance of not separating in your mind the notions of hardware and software.
Some people use the word deconstruct—the ability to go from the abstraction back to its component parts. Even the statement "Go down this street ten blocks. It allows us to deal with a situation at a higher level.
It allows us to be more efficient in our use of time and brain activity. The first involves a trip through Arizona the first author made a long time ago in the hottest part of the summer.
There is an underlying assumption to this. Their value to your development as an effective engineer or computer scientist goes well beyond your understanding of how a computer works and how to program it.
The notion of abstraction is central to all that you will learn and expect to use in practicing your craft. We will discuss each in turn.
If we had to. I knew enough to take. Two stories come to mind. You know the details. When one designs a logic circuit out of gates. The second story perhaps apocryphal is supposed to have happened during the infancy of electric power generation.
The problem immediately went away. If I had never tried to make the trip to Arizona. Arizona population 3. The result: If one spent time thinking about the details of a component when it is not necessary.
We describe logic gates in terms of transistors. That was the abstraction: And as long as nothing untoward happens. The ability to abstract is a most important skill. One does not want to get bogged down in details unnecessarily.
When one designs a sophisticated computer application program. California is not the same as the capability of a cooling system for the summer deserts of Arizona.
But if there is a problem with getting the logic circuit to work. On the front of the generator were lots of dials containing lots of information. Back came the new bill: Turning a screw 35 degrees counterclockwise: Knowing which screw to turn and by how much: General Electric Co. Something on the other side of the wall of dials and screws was malfunctioning and no one knew what to do. It is more efficient to think of entities as abstractions.
In our view. Then we build. Our approach in this book is to continually raise the level of abstraction. If the electric power generator never malfunctioned. Once we understand the abstraction of gates. One wants to think of the gate as a component. What I had not mastered was that the capability of a cooling system for Palo Alto. He looked at the dials and listened to the noises for a minute. But when there is a problem putting the components together.
To do so would slow down the process of designing the logic circuit. The controller found the bill for two minutes' work a little unsettling. In fact. By software. Intel defined additional instructions.
As you approach your study and practice of computing. They recognized that it would be important for such programs to execute efficiently. But if we have to combine multiple components into a larger system. The implication is that the person knows a whole lot about one of these two things and precious little about the other. If they don't work together. The Bottom Line Abstractions allow us to be much more efficient in dealing with all kinds of situations.
Once we understand these larger abstractions.
It is also true that one can be effective without understanding what is below the abstraction as long as everything behaves nicely. By hardware.
If we don't know the components below the level of their abstractions. It is as if there were a big wall between the hardware the computer and how it actually works and the software the programs that direct the computer's bidding.
Microprocessor designers who understand the needs of the programs that will execute on that microprocessor they are designing can design much more effective microprocessors than those who don't. And that is the state we should take care not to find ourselves in. The designer of a large computer program who understands the capabilities and limitations of the hardware that will carry out the tasks of that program can design the program more efficiently than the designer who does not understand the nature of the hardware.
When you study pointer variables in C. When you study data structures in C. Our contention is that mastering either is easier if you pay attention to both. That is OK. Which sorting program works best is often very dependent on how much the software designer is aware of the characteristics of the hardware. Chapter The Bottom Line We believe that whether your inclinations are in the direction of a computer hardware career or a computer software career. What is important to know right now is that there are important topics in the software that are very deeply interwoven with topics in the hardware.
We understand that most of the terms in the preceding five short paragraphs are not familiar to you yet. When you study recursion a powerful algorithmic device. The words in a dictionary are arranged in alphabetical order.
When you study functions in C. Students in a class are often arranged in numeric order. This book is about getting you started on the path to mastering both hardware and software. There are a huge number of fundamentally different programs one can write to arrange a collection of items in order. Most importantly. A similar story can be told about software designers. If you take the time to do that. When you study data types. One important task that almost all large software systems have to carry out is called sorting.
Although we sometimes ignore making the point explicitly when we are in the trenches of working through a concept. Twenty years ago. They usually mean the collection of parts that in combination Figure 1. When we say "performing the actual processing. When we say "directing the processing of information. A more precise term for this mechanism is a central processing unit CPU.
It directs the processing of information and it performs the actual processing of information. It does both of these things in response to a computer program.
This textbook is primarily about the processor and the programs that are executed by the processor. Unisys Corporation. A computer system usually includes. Figure 1. Chemical engineering students begin by studying chemistry. To learn the fundamental principles of computing. Without a printer. Idea 2: We describe our problems in English or some other language spoken by people. You may have to go to the store to download disks whenever it runs out of memory in order to keep increasing memory.
It is necessary to transform our problem from the language of humans to the voltages that influence the flow of electrons. Without a mouse. The slow computer just does it more slowly. Why should computing students begin by studying computers? The answer is that computers are different. This transformation is really a sequence of systematic transformations. Some computers can do things faster.
A more expensive computer cannot figure out something that a cheaper computer is unable to figure out as long as the cheap computer can access enough memory. In reality. The rest of this chapter is devoted to discussing these two ideas. Yet the problems are solved by electrons running around inside the computer. All computers can do exactly the same things. Idea 1: All computers the biggest and the smallest. After all. If you owned only an adding machine and wanted to multiply two integers. This is why digital machines—machines that perform computations by manipulating a fixed finite set of digits or letters—came to dominate computing.
The reason for this has to do with the notion that computers are universal computational devices. Some early analog adding machines worked by dropping weights on a scale. This is why computers are different.
When we study computers. The difficulty with analog machines is that it is very hard to increase their accuracy. Turing was more interested in solving a philosophical problem: How would you get an analog watch that would give you an accurate reading to one one-hundredth of a second?
You could do it. You can increase accuracy just by adding more digits. Digital adding machines were mechanical or electromechanical devices that could perform a specific kind of computation: Some were analog machines—machines that produced an answer by measuring some physical quantity such as distance or voltage.
You just give the old computer a new set of instructions or program to carry out the computation. You are familiar with the distinction between analog and digital watches. This is why we say the computer is a universal computational device. The user can read a logarithmic "distance" on the second ruler.
We learn what computation is and what can be computed. You can tell a computer how to add numbers. You can tell it how to alphabetize a list or perform any computation you like. When you think of a new kind of computation. It gives the time by the positions of its hands.
The main limitation of all of these machines is that they could do only one specific kind of computation. He began by looking at the kinds of actions that people perform when they compute. Let's see what that means. Digital watches give the time in digits. Before modern computers. You can tell it how to multiply. He gave a mathematical description of this kind of machine. Digital computers were not operating until In other parts of the world another digital machine.
Turing proposed in that all computations could be carried out by a particular kind of machine. There were also digital machines that could multiply integers. An analog watch has hour and minute hands. The idea of a universal computational device is due to Alan Turing.
Computer scientists believe that anything that can be computed. Before modern digital computers. When we talk about computers in this book. There were digital machines that could put a stack of cards with punched names in alphabetical order. Although Turing's thesis has never been proved. He gave some examples of the kinds of things that these machines could do. U would do the rest. You would simply describe to U the particular Turing machine you wanted it to simulate.
A black box model provides no information as to exactly how the operation is performed. The result of the operation is shown as output from the box. We call this Turing's thesis. In specifying U. He said that one way to try to construct a machine more powerful than any particular Turing machine was to make a machine U that could simulate all Turing machines. Turing had provided us with a deep insight: He had given us the first description of what computers do.
The data on which to operate is shown as input to the box. Turing then showed that there was. In each case. Perhaps the best argument to support Turing's thesis was provided by Turing himself in his original paper.
He abstracted these actions and specified a mechanism that could carry them out. We know. Turing proposed that every computation can be performed by some Turing machine. Suppose you wanted to compute g. One Turing machine could add two integers. This is the reason that a big or expensive computer cannot do more than a small. Computers and universal Turing machines can compute anything that can be computed because they are programmable. In both cases you give the machine a description of a computation and the data it needs.
More money may download you a faster computer. But if you have a small. Natural language is filled with ambiguity.
For every problem there are usually many different algorithms for solving that problem. There are terms to describe each of these properties. The computer. We use the term ftniteness to describe the notion that the procedure terminates. Another algorithm may allow some steps to be performed concurrently.
In the third case. They have evolved over centuries in accordance with their usage. An example of ambiguity in English is the sentence. A computer that allows more than one thing to be done at a time can often solve the problem in. In the first case. We use the term effective computability to describe the notion that each step can be carried out by a computer.
A procedure that instructs the computer to "take the largest prime number" lacks effective computability. To infer the meaning of a sentence. We use the term definiteness to describe the notion that each step is precisely stated. An algorithm is a step-by-step procedure that is guaranteed to terminate. To tell it to do something where there are multiple interpretations would cause the computer to not know which interpretation to follow.
Such ambiguity would be unacceptable in instructions provided to a computer. They are fraught with a lot of things unacceptable for providing instructions to a computer. One algorithm may require the fewest number of steps. Most important of these unacceptable attributes is ambiguity. If we ignore any of the levels. A recipe for excellent pancakes that instructs the preparer to "stir until lumpy" lacks definiteness.
In the second case. There is generally one such low-level language for each computer. A data type is a legitimate representation for an operand such that the computer can perform operations on that representation. High-level languages are at a distance a high level from the underlying computer. In the second half of this book. Pascal is a language invented as a vehicle for teaching beginning students how to program.
Programming languages are "mechanical languages. Prolog is the language of choice for many applications that require the design of an expert system. Some have been designed for use with particular applications. Other languages are useful for still other purposes. They are called data types. The instruction set architecture ISA is the complete specification of the interface between programs that have been written and the underlying computer hardware that must carry out the work of those programs.
That language is called the assembly language for that computer. We say the language is "machine independent. Low-level languages are tied to the computer on which the programs will execute.
LISP was for years the language of choice of a substantial number of people working on problems dealing with artificial intelligence. There are more than 1. There are two kinds of programming languages. The ISA specifies the mechanisms that the computer can use to figure out where the operands are located. The ISA specifies the set of instructions the computer can carry out. The ISA specifies the acceptable representations for operands. At their best. The term operand is used to describe individual data values.
These mechanisms are called addressing modes. The automobile provides a good analogy of the relationship between an ISA and a microarchitecture that implements that ISA. For each high-level language and each desired target computer. The translation from the unique assembly language of a computer to its ISA is done by an assembler. The number of operations. Some ISAs have as few as a half dozen operations. The original implementation was the in Some ISAs have only one data type.
The ISA is about basic functionality. The detailed organization of an implementation is called its microarchitecture. The most common example is the x Some ISAs have one or two addressing modes. Computer design is always an exercise in trade-offs. To translate from a program written in C to the x86 ISA.
Of the three pedals on the floor. The x The ISA also specifies the number of unique locations that comprise the computer's memory and the number of individual 0s and Is that are contained in each location. Many ISAs are in use today. All cars can get from point A to point B. Intel introduced the Pentium IV microprocessor. The one on the right is the accelerator.
More recently. The translation from a high-level language such as C to the ISA of the computer on which the program will execute such as x86 is usually done by a translating program called a compiler. Each implementation is an opportunity for computer designers to make different trade-offs between the cost of the microprocessor and the performance that microprocessor will provide.
If we could speak electron. Some are turbocharged. We show how transistors combine to form logic circuits.
Our handling of those choices determines the resulting cost and performance of our computer. In this book. We complete the process by going from the Englishlanguage description of a problem to a C program that solves the problem. Some automobiles have eight cylinders. Since we can't speak electron and they can't speak English. We hope you enjoy the ride. At each level of transformation. Here all automobile makes and models are different.
Cb multiplication. Exercises 17 1. The average of the four input numbers w. Using the notion of abstraction. In the taxi example. See Figure 1. Assume we have an unlimited number of these boxes. Can a higher-level programming language instruct a computer to compute more than a lower-level programming language? What difficulty with analog computers encourages computer designers to use digital designs? Name one characteristic of natural languages that prevents them from being used as programming languages.
Say we had another box capable of multiplying two numbers together. Show how to connect them together to calculate: Say we had a "black box. The discussion of abstraction in Section 1. Are natural languages capable of expressing algorithms? Briefly explain each of these three characteristics.
How many reasonable interpretations can you provide for this statement? List them. Create pairs of prime and natural numbers by matching the first prime number with 1 which is the first natural number and the second prime number with 2.
Add all the individual products together to derive the dot product. Calvin does not trust Lynne and suspects that the quarter may be weighted meaning that it might favor a particular outcome when tossed and suggests the following procedure to fairly determine who will walk the dog. Suppose you're given two vectors each with 20 elements and asked to perform the following operation. Columns run vertically. If the outcome is heads on the first flip and tails on the second.
Add the first row of the following matrix to another row whose first column contains a nonzero entry. Lynne suggests that they flip a coin and pulls a quarter out of her pocket.
If the outcome is tails on the first flip. If not. In order to show that there are as many prime numbers as there are natural numbers. What property does this sentence demonstrate that makes it unacceptable as a statement in a program. Lynne and Calvin are trying to decided who will take the dog for a walk.
Flip the quarter twice. Do the same to the second elements. Take the first element of the first vector and multiply it by the first element of the second vector. How many transformation processes are possible if instead of three different microarchitectures for x86 and three different microarchitectures for SPARC.
Identify one disadvantage. A and B. Pentium IV microarchitecture" one transformation process. Then test the result you got when you subtracted one. How many transformation processes are possible? Both have add instructions.
We could then program our bubble sort algorithm in C. One algorithm that can accomplish that is called the bubble sort. Add four 3. If both outcomes are tails or both outcomes are heads. Exercises 19 4. Both have instructions that can take a value and produce the negative of that value. Write three examples of transformation processes. Given a number. Subtract one 7. C program. If not 0. Is Calvin's technique an algorithm? Subtract two 5.
Prove your result. Multiply it by four 2. Which computer is able to solve more problems. Let us call the sequence "Bubble Sort.
Divide by two 4. Assume we have available four sorting algorithms and can program in C. Divide by two 6. We call the act of doing so sorting. Suppose you were given a task at one of the transformation levels shown in Figure 1. If no. When you upgrade your computer or download one with a newer CPU. Is that a reasonable characterization? If yes. At which level would it be most difficult to perform the transformation to the next lower level? What form is the software actually in?
Is it in a high-level programming language? Is it in assembly language? Is it in the ISA of the computer on which you'll run it?
Justify your answer. We symbolically represent the presence of a voltage as "1" and the absence of a voltage as "0.
These devices react to the presence or absence of voltages in electronic circuits. Your finger casually inserted into the wall socket. Recall the digits you have been using since you were a. To understand this. They could react to the actual voltages. Inside the computer. A problem stated in a natural language such as English is actually solved by the electrons moving around inside the electronics of the computer. It is much easier simply to detect whether or not a voltage exists between a pair of points in a circuit than it is to measure exactly what that voltage is.
Dafa Types. You could measure the exact voltage it is carrying. Data Types. The value five can also be represented by someone holding up one hand. We say a particular representation is a data type if there are operations in the computer that can operate on information that is encoded in that representation. The voltage on one wire can represent uniquely one of only two things.
This is the standard decimal notation that you are used to. We will see momentarily that a fourth notation for five is the binary representation That data type is usually called floating point. Each ISA has its own set of data types and its own set of instructions that can operate on those data types.
To get useful work done by the computer. We will show you its representation in Section 2. In general. Both data types will be explained shortly.
Recall the "scientific notation" from high school chemistry where you were admonished to represent the decimal number as 6. It is not enough simply to represent values.
There are 10 of them. The person is saying. Each pattern of these k bits is a code. In the case of binary digits. One thing can be represented by 0. The Romans had yet another notation for five—the character V.
There are other representations of information that could be used. This notation has a name also—unary. There are computers that represent numbers in that form.
To be perfectly precise. The 3 is worth much more than the 9. Since 2 5 is Positive integers are represented in the straightforward positional scheme. This is because. The 2's complement representation works the same way.
To do this. In our five-bit example. We are still left with the problem of determining what codes to assign to what values. In this way. One of them. There are 30 such integers. If we wish to perform a task some specific number of times. Since there are k bits.
Unsigned integers have many uses in a computer. We can represent unsigned integers as strings of binary digits. That leaves one more five-bit code to assign. We could take our 2k distinct patterns of k bits and separate them in half. You are familiar with the decimal number A second idea which was actually used on some early computers such as the Control Data Corporation was the following: Let a negative number be represented by taking the representation of the positive number having the same magnitude.
The first thought that usually comes to mind is: If a leading 0 signifies a positive integer.
The result is the signed-magnitude data type shown in Figure 2. What about the representations for the negative numbers in our five-bit example. It is called an arithmetic and logic unit. The addition is as follows: And you would be right! The choice of representations for the negative integers was based. It simply adds the two binary patterns. What is particularly relevant is that the binary ALU does not know and does not care what the two patterns it is adding represent.
Why were the representations chosen that way? The positive integers. What is relevant right now is that an ALU has two inputs and one output.
With five bits. It performs addition by adding the binary bit patterns at its inputs. The result is the 2's complement data type. Because computer designers knew what it would take to design a logic circuit to add two integers. If the addition in a column generates a carry. We will get into the actual structure of the ALU in Chapters 3 and 4. This data type is referred to in the computer engineering community as 1's complement.
It is used on just about every computer manufactured today. Almost all computers use the same basic mechanism to do addition. Note in particular the representations for — 1 and 0. We can express this mathematically as: To accomplish that. If we then add to Adding 1 to gives us Then the representation for A is When we add to the representation for —1. That carry does not influence the result. We can verify our result by adding the representations for A and.
Example 2. The sum of A and the complement of A is Flip all the bits of A the term for "flip" is complement. The complement of A is What value shall we assign to it?
We note that—1 is We also have a representation for 0. If we continue this. In Chapter 5 we will specify a computer that we affectionately have named the LC-3 for Little Computer 3. We have constructed 15 negative integers. Note that. The LC-3 operates on bit values. For purposes of illustration. In that case.
The remaining representation is Examine the leading bit aj. We must first find the 2's complement representation of the positive number of the same magnitude. The decimal integer value corresponding to is Sincc ihc leading binary digit is a 1. Consider again our generic eight-bit representation: Starting where we left off. This is The crux of the method is to note that a positive binary number is odd if the rightmost digit is 1 and even if the rightmost digit is 0.
Our first step is to find values for a. We subtract 1 from both sides of the equation. We now iterate the process. Since the value is positive.
If N is odd. Let's summarize the process. Subtract 1 or 0 according to whether N is odd or even from N. If N is even. At each point. Arithmetic Therefore. Arithmetic 2. If the original decimal number is positive.
Instead of generating a carry after 9 since 9 is the largest decimal digit. If the original decimal number is negative. The binary representation is Each iteration produces the value of one coefficient a. If we are given a decimal integer value N. Addition still proceeds from right to left. The decimal value 14 is represented as The decimal value 9 is represented as First we form the negative.
Is that a curiosity. Let's assume for this example eight-bit codes. If we add 59 to itself.. The decimal value 11 is represented as The decimal value 3 is represented The sum. Consider a value for A. Note that the bits have all shifted to the left by one position. Note again that the carry out is ignored. There is little confusion. If we take the absence of a bit to be a 0. Sign-extension is performed in order to be able to operate on bit patterns of different lengths. If we do not represent the two values with the same number of bits.
In order to add representations of different lengths. What happens if such is not the case? You are undoubtedly familiar with the odometer on the front dashboard of your automobile. It does not affect the values of the numbers being represented. If 5 is represented as The value of a positive number does not change if we extend the sign bit 0 as many bit positions to the left as desired. Long term, short term and medium term scheduling. Scheduling criteria. Algorithm evaluation: deterministic and probabilistic models, simulation.
Process synchronization: data coherency, atomic operations. Critical sections. SW approaches for mutual exclusion: Peterson and Dekker's algorithms, baker's algorithm. HW for mutual exclusion: test and set, swap. Synchronization constructs: semaphores, mutex, monitor. Deadlock: Deadlock conditions. Resource allocation graph. Deadlock prevention. Deadlock avoidance. Banker's algorithm. Deadlock detection e recovery.
Memory management: Main memory. Logical and physical addressing. Relocation, address binding. Memory allocation. Internal and external fragmentation. HW for paging: TLB. Page table. Multi-level paging. Segment table. Segmentation with paging. Virtual memory: Paging on demand. Page fault management. Page buffering. Frame allocation: local and global allocation. Working set model.