Operating systems—interrupts and exceptions, disk scheduling algorithms, operating system stuff

abnormal

It is often caused by internal events of the CPU * executing instructions, such as illegal opcodes, address out-of-bounds, arithmetic overflow, etc., as well as page fault exceptions and division by 0 exceptions.At the same time, he will send to the kernel to ask the kernel to handle these exceptions

external interrupt

Interruption in a narrow sense refers to external interruption. Caused by an event other than the CPU executing an instruction, such as an I/O completion interrupt. In addition, there are clock interrupts, console interrupts, etc.
Interrupts are generated by hardware devices, and they are physically electrical signals. Then it is sent to the CPU through the interrupt controller, and then the CPU judges which hardware device the received interrupt comes from (this is defined in the kernel), and finally, the CPU sends it to the kernel, and the kernel handles the interrupt.
Image source Axiu's study notes
insert image description here

Differences and Similarities Between Interrupts and Exceptions

Similarity

  • They are all sent to the kernel by the CPU and processed by the kernel

different

  • Exceptions are generated by the CPU, and interrupts are generated by hardware devices
  • The kernel needs to call different handlers depending on whether it is an exception or an interrupt
  • Interrupts are not clock-synchronous, which means that interrupts may come at any time; exceptions are generated by the CPU, so they are clock-synchronous
  • When handling an interrupt, it is in the interrupt context; when handling an exception, it is in the process context

Disk Scheduling Algorithm

Factors that affect the time to read and write a disk block include: rotation time (moving the head to the appropriate sector), seek time (moving the head to the appropriate track), and actual data transfer time.Among them, the longest seek time

  • first come first serve
  • shortest seek time first
  • elevator scan

ASCII, UNICODE, UTF-8 relationship

  • In the computer memory, Unicode encoding is uniformly used, and when it needs to be saved to the hard disk or needs to be transmitted, it is converted to UTF-8 encoding.
  • When editing in Notepad, the UTF-8 characters read from the file are converted into Unicode characters and stored in the memory; after editing, the Unicode is converted to UTF-8 and saved to the file when saving.
  • When browsing the web, the server will convert the dynamically generated Unicode content into UTF-8 and then transmit it to the browser.

von Neumann structure

  • memory: internal memory
  • Controller: South Bridge North Bridge
  • Calculator: CPU
  • Input device: keyboard
  • Output device: monitor, network card

Server high concurrency solution

  • Application data is separated from static resources, and static resources are stored separately in a dedicated static resource server
  • Client-side caching: The pages on the website are implemented as static as possible. After the page expires or data is updated, the page is re-cached. Or first generate a static page, and then use ajax asynchronous request to get dynamic data
  • Clustering and distributed, clustering means that all servers have the same function and play a role in shunting; distributed means putting different services in different servers. Server clusters and distributed architecture can be used to distribute the computing pressure originally belonging to one server to multiple servers.
  • Reverse proxy: The server obtains resources through other servers or returns the results to the client.

Guess you like

Origin blog.csdn.net/qaaaaaaz/article/details/131403041