lsq blog

嘿,朋友! 如果是你,请打招呼!

OS 3虚拟内存管理

1 背景 在物理内存分配方法中,要求执行指令必须在物理内存中,满足这一要求的方法是将整个进程放在内存中。这使得程序的大小被限制在物理内存的大小以内,然而在许多情况下,并不需要将整个程序放到内存中。能够执行只有部分在内存中的程序可以带来许多好处: 程序不再受现有的物理内存空间限制。 更多的程序可以同时执行,CPU的利用率也相应增加 。 由于载入或交换每个用户程序到内存所需的I...

OS 2物理内存管理

1 背景 内存是现代计算机运行的中心,内存由很大一组字或字节组成,每个字或字节都有它们自己的地址,CPU根据程序计数器的值从内存中读取指令,这些指令可能会引起进一步对特定内存地址的读取和写入。一个典型的指令执行周期,首先从内存中读取指令,接着该指令被解码,且可能需要从内存中读取操作数,在指令对操作数执行后,其结果可能被存回到内存。 CPU能直接访问的存储器只有内存和处理器内的寄存器,机器指...

OS 1导论

操作系统是管理计算机硬件并提供应用程序运行环境的软件。也许操作系统最为直观之处在于它提供了人与计算机系统的借口。 为了让计算机系统执行程序,程序必须位于内存中。内存是处理器能直接访问的唯一大容量存储区域。内存是易失性存储器,当没有电源时会失去其内容。绝大多数计算机系统都提供了外存以扩充内存,比如最常用的磁盘。 根据速度和价格,可以将计算机系统的不同存储系统按照层次来组织。最高层最贵最快,...

leetcode 15 3Sum

题干 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not...

leetcode 11 Container With Most Water

题干 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find...

leetcode 6 ZigZag Conversion

题干 The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P—A—H—N A-P-L-S-I-I...

leetcode 5 Longest Palindromic Substring

题干 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: “babad” Output: “bab” Note: “aba” is also a valid answer....

leetcode 3 Longest Substring Without Repeating Characters

题干 Given a string, find the length of the longest substring without repeating characters. Example 1: Input: “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Exam...

leetcode 2 add two numbers

题干 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and re...