Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Too slow to bear, CPU operated on the hard drive and network card again.

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >

Share

Shulou(Shulou.com)11/24 Report--

This article comes from the official account of Wechat: programming Technology Universe (ID:xuanyuancoding), author: Xuanyuan Wind O

Bus technology I'm Ah Q from CPU No.1 workshop. I've been bothered by one thing recently.

When our CPU factory first came to build a factory on the motherboard, there were not many units on the motherboard at that time, and the guy who dealt with us most was the memory guy.

Later, keyboards, mice, hard drives, network cards, sound cards, graphics cards and other devices have entered the motherboard, this land is becoming more and more lively.

However, their arrival did not affect our status, after all, we are the CPU, everyone has to listen to our command.

In order to communicate with these guys on the motherboard, we spent a lot of money to lay a line, and every household on the motherboard is connected to this line. We call it a bus. Although it is a bus, it actually contains a data bus for data transmission, an address bus for transmitting addresses and a control bus for control and management.

In this way, all units can chat together. However, this line is shared, we can not all transmit data together, that will be a mess. In order to unify the management, we have set up a new unit called the bus controller, which manages the bus uniformly. If we want to communicate, we have to apply to it, which is called bus arbitration.

However, the speed of the units on the motherboard is still very different, such as memory is much faster than hard drives and network cards (of course, it is still not comparable to the working speed of our CPU workshop). Not only that, the interfaces of different units are also very different, and the contradiction with one set of bus has become increasingly obvious, and then it has become a multi-level bus, allowing slow to play, fast to play fast. Finally, we use one thing to connect different buses, this thing is the bridge!

Later, two famous bridges appeared on the motherboard. One is called the North Bridge, which is very close to our CPU. The guy who communicates with us in memory will pass through it. The other one is called the South Bridge, and the slower I / O devices will be connected through the South Bridge. Later, with the growth of our CPU factory, we bought Beiqiao directly, and now it has become a department of our factory.

PIO mode now we can communicate with these I / O devices, take the hard disk, for example, it has I / O port, we provide two instructions in and out, we can read and write data to it. This method of communication is called programmable input / output model, Programming Input / Output Model, or PIO for short.

We are the core of the whole motherboard, as the saying goes, the greater the ability, the greater the responsibility, but sometimes I really feel a little tired.

As more and more devices are connected to the motherboard, more and more programs are waiting for us to execute, and we are out of breath because of the heavy workload.

Especially with the progress of technology, the speed of our CPU factory is getting faster and faster, and the gap between the reading and writing speed of our hard disk is getting wider and wider. It is a waste of our time for us to communicate in this way.

DMA technology these days, the Leader of several of our workshops got together in private to discuss this matter.

"Ah Q, don't you think we spend too much time reading and writing to the hard drive now? it's not his fault that this guy is slow. It's his fault to hold us back. Once we transfer data, we have to perform many I / O port reads and writes, and our precious time is wasted on it!" Huzi in Workshop 2 said with a resentful look on his face.

"Hey, I'm worried about this recently, too. There are more and more programs, and I spend more and more time reading and writing hard drives, especially that MySQL, who keeps letting me access the hard drive, which is exhausting me."

Unexpectedly, we both held back a lot of bitterness.

At this time, the boss of the No. 8 workshop, who is usually fond of sucking up to the boss, said, "the problem you are talking about does exist. This job is too unskilled. It's just a manual job. Why don't we tell the boss about it and let him outsource it?"

As soon as we heard it, it was wonderful. It would be great if we could outsource the manual work, so we could concentrate on our full-time work.

"you are usually close to the boss, you can talk about it." I winked at Huzi and encouraged the old man to talk about it.

All right, I'll go. I'll go alone.

Not to mention, the leader immediately agreed to this idea, after all, can improve our work efficiency, he naturally raised his hands to welcome.

It wasn't long before we set up an outsourcing team, independent of our factory, to take charge of this matter. Like our CPU, they also provide several registers. When transferring data, we just need to set the contents of these registers and tell them where to transfer the data, from where to where, and how long it is, so we don't have to worry about the rest and let them finish it. We can make time to do other things, and when the data transmission is finished, they will tell us by way of interruption that we can just deal with it directly, eliminating the process of letting us carry it ourselves. It's really cool to fly.

Later, we also named this technology Direct Memory Access, Direct memory access, or DMA for short, and this outsourced team is the DMAC,DMA controller.

At the monthly wrap-up meeting a few days before the full bloom of DMA, the leader praised eight, saying that thanks to his suggestion, the production efficiency of the factory had been greatly improved. If I had known, I wouldn't have encouraged Hachi to give advice to the boss. I went by myself.

I was thinking about mind-wandering when I suddenly thought of a problem. This time I intend to seize the opportunity to earn a performance.

"Boss, this DMA technology is good, but now it can only be used for hard drives. Recently, the guy with the network card also has a lot of data packets. I spent a lot of time reading the data packets from the network card to memory, which is inefficient and has no technical content. Can I extend this technology to the network card?" Well, I got up and said.

The boss nodded thoughtfully.

Seeing this, Huzi in Workshop 2 got up and said, "Boss, in addition to hard drives and network cards, monitors also have this need. I often have to work hard to transfer memory data to the monitor. I suggest that DMA technology should also be extended to the monitor."

After hearing this, the boss frowned and said, "the difference between different devices is quite big and cannot be used." is it difficult for us to set up an outsourcing team for each equipment? the cost is a little high. "

Sure enough, the boss is still the boss, and he still takes cost as the first consideration.

At this time, the brown-nosing old eight spoke again, "what the boss said. I do have a suggestion that this DMA can be extended to units such as network cards and monitors, but let them increase the DMAC at their own expense and do it according to their different needs. We can't be such bad guys."

When the boss heard this, he was beaming with joy and cheered loudly.

In this way, we soon popularized this technology, and those units headed by network cards, monitors and cameras on the motherboard embraced changes and integrated DMAC in order not to lag behind others.

We are so liberated that we don't have to be boring porters anymore.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

IT Information

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report