In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the Java IO-related knowledge points, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.
1, user space, system space
The Linux system will divide a process into two spaces, user space and system space. For example, we normally encode and operate in user space. If we need to call system functions, such as copying system files, we need to call system components, get kernel services, and complete the operation.
Two stages of IO
The execution of IO is divided into two stages, waiting for it to be ready and performing a copy
Wait ready: we know that when we perform an IO operation, the data may come from another application or network. If there is no data, the operating system will wait all the time, and the application may also wait.
Perform a copy: copy data to the application workspace
Blocking and non-blocking, synchronous and asynchronous
To talk about synchronization and non-synchronization first, the simplest thing is to see whether to start a thread or process to complete IO. When synchronizing IO, the system will stop and wait for this to be done before doing anything else, while asynchronous IO uses multithreading to start a new thread to do this, and it can do something else and wait for notice.
Let's talk about blocking and non-blocking, which are actually concerned with the state of the program while waiting for the result of the call. Blocking means that when you get the result, you will hang until you wait until the complete result. Non-blocking means that there is no blocking thread when the process cannot get the result. This is a bit of a twist, and there is a popular explanation if it is blocked. I'm going to get this thing, and in the process, I lose the CPU, and I won't get the CPU until the result, but if I'm non-blocking, I'll keep holding the CPU, and I can keep checking it.
Several IO models
At present, there are five kinds.
Blocking IO
The most traditional kind of IO, that is, blocking occurs in reading and writing.
Non-blocking IO
When a user initiates read, he will not lose CPU, but will always check. If it is not successful, an error will be returned. If a successful signal is received, a read operation will be initiated to obtain the complete result.
Multiplexing IO
This is the core of Java NIO, there will be a thread to manage the state of multiple socket, check whether it is ready, only found that really ready, will call cpu to perform IO operations, this is more important
Signal driven IO
Use less, ignore
Asynchronous IO
Start a thread to execute it.
Thank you for reading this article carefully. I hope the article "what are the knowledge points related to IO in Java" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.