Threads The thread defines a sequential execution stream within a process. Processes The process defines the address space and general process attributes (everything but threads of execution) Kernel-level thread OS-managed threads are called kernel-level threads or lightweight processes. Thread operations still require system calls Kernel-level threads have to be general to support the needs of …
Notes on “Process” and “Process API”
Process The abstraction provided by the OS of a running program is something we will call a process. The process is the OS abstraction for execution A process is sometimes called a job or a task or a sequential process A sequential process is a program in execution A process contains all state for a …
Notes on “Mechanism: Limited Direct Execution”
Architecture must support (at least) two modes of operation: Mode is indicated by a status bit in a protected control register User programs execute in user mode OS executes in kernel, privileged mode (OS == “kernel”) User mode code that runs in user mode is restricted in what it can do. For example, when running …
Continue reading “Notes on “Mechanism: Limited Direct Execution””
Rotate Array
This is No.189 problem in LeetCode. The problem description is: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to …
How to let WordPress only displays summary of article on home page
Firstly, find the directory: Appearance -> Theme Editor -> Main Index Template -> index.php, and locate the code: /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called …
Continue reading “How to let WordPress only displays summary of article on home page”
A Simple Calculator Application On Android Studio
1. Open Android Studio and create a new project. 2. Set the basic information and choose API. 3. Finish basic setting and choose activity platform (Basic Activity Here). 4. See the main page. 5. Remove some irrelevant code from activity_main.xml. Click the text button on the bottom of activity_main.xml. Delete FloatingActionButton which will show e-mail …
Continue reading “A Simple Calculator Application On Android Studio”
Dynamic Programming
What is Dynamic Programming? Let’s have a look at the definition on Introduction to Algorithm: "Dynamic programming like the divide-and-conquer method, solves problems by combining the solutions to sub-problems. Different from divide-and-conquer, dynamic programming applies when the sub-problems overlap — that is, when sub-problems share sub-sub-problems. A dynamic programming algorithm solves each sub-sub-problems just once …
Convert Sorted Array to Binary Search Tree
This is NO.108 problem in leetcode. The description of this problem is: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ …
Continue reading “Convert Sorted Array to Binary Search Tree”
Symmetric Tree – recursion and iteration
This is No.101 problem in leetcode. The question is: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). 1.Recursion: Recursion occurs when a thing is defined in terms of itself or of its type. In this problem, I will solve it in recursion first. The thought is …