
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://ricefriedegg.com:80/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rice</id>
	<title>Rice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://ricefriedegg.com:80/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rice"/>
	<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php/Special:Contributions/Rice"/>
	<updated>2026-04-09T13:01:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=1002</id>
		<title>Thread</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=1002"/>
		<updated>2024-10-07T19:28:33Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:OSTEP 26.1.png|thumb|Credits to OSTEP textbook]]&lt;br /&gt;
A &#039;&#039;&#039;thread&#039;&#039;&#039; in Computer Science is defined as a sequence of executing instructions from a program. Notably, it is active/running. It is different from a process in that multiple threads can share an [[address space]].&lt;br /&gt;
&lt;br /&gt;
The state of a thread consists of the Program Counter and the set of register values.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;thread control block (TCB)&#039;&#039;&#039; stores the states of threads to enable switching between them.&lt;br /&gt;
&lt;br /&gt;
Each thread will also have its own stack, which is thus called &#039;&#039;&#039;thread-local storage&#039;&#039;&#039;. The address space diagram shows that not all stacks can grow indefinitely and may run into problems if there are lots of recursion.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
The first motivation for threads is &#039;&#039;&#039;parallelizing operations&#039;&#039;&#039; to multiple processors, which may speed up certain operations such as array calculations significantly.&lt;br /&gt;
&lt;br /&gt;
The second motivation is to avoid progress being blocked by I/O such as disk read/writes.&lt;br /&gt;
&lt;br /&gt;
== Downsides ==&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=1001</id>
		<title>Thread</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=1001"/>
		<updated>2024-10-07T19:17:01Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:OSTEP 26.1.png|thumb|Credits to OSTEP textbook]]&lt;br /&gt;
A &#039;&#039;&#039;thread&#039;&#039;&#039; in Computer Science is defined as a sequence of executing instructions from a program. Notably, it is active/running. It is different from a process in that multiple threads can share an [[address space]].&lt;br /&gt;
&lt;br /&gt;
The state of a thread consists of the Program Counter and the set of register values.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;thread control block (TCB)&#039;&#039;&#039; stores the states of threads to enable switching between them.&lt;br /&gt;
&lt;br /&gt;
Each thread will also have its own stack, which is thus called &#039;&#039;&#039;thread-local storage&#039;&#039;&#039;. The address space diagram shows that not all stacks can grow indefinitely and may run into problems if there are lots of recursion.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=File:OSTEP_26.1.png&amp;diff=1000</id>
		<title>File:OSTEP 26.1.png</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=File:OSTEP_26.1.png&amp;diff=1000"/>
		<updated>2024-10-07T19:15:25Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;From the OSTEP textbook, Single-threaded vs multi-threaded process address space&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=999</id>
		<title>Address space</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=999"/>
		<updated>2024-10-04T18:43:56Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;address space&#039;&#039;&#039; of a process usually consists of three segments&lt;br /&gt;
&lt;br /&gt;
* Stack&lt;br /&gt;
* Data&lt;br /&gt;
* Code&lt;br /&gt;
&lt;br /&gt;
Typically, stack and data segments are dynamic.&lt;br /&gt;
&lt;br /&gt;
Address space abstracts physical memory in the following three ways:&lt;br /&gt;
&lt;br /&gt;
* Address independence: Each process has its own memory&lt;br /&gt;
* Protection: that only it can access&lt;br /&gt;
* Virtual memory: that is large&lt;br /&gt;
&#039;&#039;&#039;Multiprogramming&#039;&#039;&#039; allows multiple processes in memory at a time. This is motivated by the observation that most processes would only require a small bit of memory at a time. &#039;&#039;&#039;Address translation&#039;&#039;&#039; by the [[MMU]] is used to avoid conflicting addresses by using symbolic addresses to represent physical addresses.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=998</id>
		<title>Address space</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=998"/>
		<updated>2024-10-04T18:40:23Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;address space&#039;&#039;&#039; of a process usually consists of three segments&lt;br /&gt;
&lt;br /&gt;
* Stack&lt;br /&gt;
* Data&lt;br /&gt;
* Code&lt;br /&gt;
&lt;br /&gt;
Typically, stack and data segments are dynamic.&lt;br /&gt;
&lt;br /&gt;
Address space abstracts physical memory in the following three ways:&lt;br /&gt;
&lt;br /&gt;
* Address independence: Each process has its own memory&lt;br /&gt;
* Protection: that only it can access&lt;br /&gt;
* Virtual memory: that is large&lt;br /&gt;
&#039;&#039;&#039;Multiprogramming&#039;&#039;&#039; allows multiple processes in memory at a time. This is motivated by the observation that most processes would only require a small bit of memory at a time. &#039;&#039;&#039;Address translation&#039;&#039;&#039; is used to avoid conflicting addresses by using symbolic addresses to represent physical addresses.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=997</id>
		<title>Address space</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=997"/>
		<updated>2024-10-04T18:39:28Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;address space&#039;&#039;&#039; of a process usually consists of three segments&lt;br /&gt;
&lt;br /&gt;
* Stack&lt;br /&gt;
* Data&lt;br /&gt;
* Code&lt;br /&gt;
&lt;br /&gt;
Typically, stack and data segments are dynamic.&lt;br /&gt;
&lt;br /&gt;
Address space abstracts physical memory in the following three ways:&lt;br /&gt;
&lt;br /&gt;
* Address independence: Each process has its own memory&lt;br /&gt;
* Protection: that only it can access&lt;br /&gt;
* Virtual memory: that is large&lt;br /&gt;
&#039;&#039;&#039;Multiprogramming&#039;&#039;&#039; allows multiple processes in memory at a time. This is motivated by the observation that most processes would only require a small bit of memory at a time.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=996</id>
		<title>Address space</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=996"/>
		<updated>2024-10-04T18:34:11Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;address space&#039;&#039;&#039; of a process usually consists of three segments&lt;br /&gt;
&lt;br /&gt;
* Stack&lt;br /&gt;
* Data&lt;br /&gt;
* Code&lt;br /&gt;
&lt;br /&gt;
Typically, stack and data segments are dynamic.&lt;br /&gt;
&lt;br /&gt;
Address space abstracts physical memory in the following three ways:&lt;br /&gt;
&lt;br /&gt;
* Address independence: Each process has its own memory&lt;br /&gt;
* Protection: that only it can access&lt;br /&gt;
* Virtual memory: that is large&lt;br /&gt;
&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=995</id>
		<title>Address space</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Address_space&amp;diff=995"/>
		<updated>2024-10-04T18:28:29Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;address space&amp;#039;&amp;#039;&amp;#039; of a process usually consists of three segments  * Stack * Data * Code  Typically, stack and data segments are dynamic. Category:Operating System&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;address space&#039;&#039;&#039; of a process usually consists of three segments&lt;br /&gt;
&lt;br /&gt;
* Stack&lt;br /&gt;
* Data&lt;br /&gt;
* Code&lt;br /&gt;
&lt;br /&gt;
Typically, stack and data segments are dynamic.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=994</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=994"/>
		<updated>2024-10-04T18:27:30Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Machine state */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more [[Thread|threads]] in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The [[address space]]&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
The kernel also keeps a table of all the metadata of processes. This include PID, parent, page tables, etc.&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
The syscall &#039;&#039;fork&#039;&#039; clones a process almost perfectly. For example, the child process would not start running at &#039;&#039;main&#039;&#039;; instead, it continues where the parent leaves off. The only differences between the two processes is the return value of &#039;&#039;fork&#039;&#039;: In the parent it is the PID of the child, whereas in the child it is 0. This syscall is notably non-deterministic, as the CPU scheduler is free to run either process before the other.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;wait&#039;&#039; syscall halt execution of the parent until the child is complete.&lt;br /&gt;
&lt;br /&gt;
To run a new process, the &#039;&#039;exec&#039;&#039; syscall can be used. It replaces the current process with that specified in the arguments.&lt;br /&gt;
&lt;br /&gt;
== Motivation of &#039;&#039;fork&#039;&#039; ==&lt;br /&gt;
The motivation behind this unintuitive set of APIs (fork, wait, exec) is to allow the parent process time to alter the environment of the child process.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=993</id>
		<title>Limited direct execution</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=993"/>
		<updated>2024-10-04T18:08:37Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Limiting operations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Limited direct execution&#039;&#039;&#039; is a technique of allowing programs to partially execute on the CPU directly. This ensures the two necessities of CPU [[virtualization]]: performance and control.&lt;br /&gt;
&lt;br /&gt;
== Direct execution ==&lt;br /&gt;
[[File:OSTEP 6.1.png|thumb|OSTEP: Direct Execution Protocol (Without Limits)]]&lt;br /&gt;
Let&#039;s first talk about the simpler sibling of limited direct execution. &#039;&#039;&#039;Direct execution&#039;&#039;&#039; (without limits) simply allows programs to run on the CPU.&lt;br /&gt;
&lt;br /&gt;
This approach, while fast and simple, has problems over &#039;&#039;control&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Restricted operation:&#039;&#039;&#039; How does the OS stop processes from doing things we don&#039;t want it to do?&lt;br /&gt;
* &#039;&#039;&#039;Switching between processes:&#039;&#039;&#039; How does the OS stop an executing process, which is needed for time sharing?&lt;br /&gt;
&lt;br /&gt;
== Limiting operations ==&lt;br /&gt;
There are many things that a user may not want a process to do. For example, performing I/O operations to disks, demanding more system resources, etc. Many functions that we take for granted would be impossible on a direct execution system, an example being limiting disk access to certain programs/users with file permissions.&lt;br /&gt;
&lt;br /&gt;
To limit sensitive operations, most operating systems have two modes: &#039;&#039;&#039;kernel mode&#039;&#039;&#039; and &#039;&#039;&#039;user mode&#039;&#039;&#039;. In kernel mode, all instructions are fair game. In user mode, certain sensitive operations such as I/O and process/resource management would raise an exception.&lt;br /&gt;
&lt;br /&gt;
We want to limit a process&#039; control but still allow them to perform necessary functions. This is done through &#039;&#039;&#039;system calls&#039;&#039;&#039;. When a user program wants to access restricted resources, they make a system call, which then use the &#039;&#039;&#039;trap&#039;&#039;&#039; instruction to elevate to kernel mode. The kernel then checks the necessary permissions.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=992</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=992"/>
		<updated>2024-10-02T18:19:09Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Process state */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more [[Thread|threads]] in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
The kernel also keeps a table of all the metadata of processes. This include PID, parent, page tables, etc.&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
The syscall &#039;&#039;fork&#039;&#039; clones a process almost perfectly. For example, the child process would not start running at &#039;&#039;main&#039;&#039;; instead, it continues where the parent leaves off. The only differences between the two processes is the return value of &#039;&#039;fork&#039;&#039;: In the parent it is the PID of the child, whereas in the child it is 0. This syscall is notably non-deterministic, as the CPU scheduler is free to run either process before the other.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;wait&#039;&#039; syscall halt execution of the parent until the child is complete.&lt;br /&gt;
&lt;br /&gt;
To run a new process, the &#039;&#039;exec&#039;&#039; syscall can be used. It replaces the current process with that specified in the arguments.&lt;br /&gt;
&lt;br /&gt;
== Motivation of &#039;&#039;fork&#039;&#039; ==&lt;br /&gt;
The motivation behind this unintuitive set of APIs (fork, wait, exec) is to allow the parent process time to alter the environment of the child process.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=991</id>
		<title>Limited direct execution</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=991"/>
		<updated>2024-10-02T18:01:08Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Limited direct execution&#039;&#039;&#039; is a technique of allowing programs to partially execute on the CPU directly. This ensures the two necessities of CPU [[virtualization]]: performance and control.&lt;br /&gt;
&lt;br /&gt;
== Direct execution ==&lt;br /&gt;
[[File:OSTEP 6.1.png|thumb|OSTEP: Direct Execution Protocol (Without Limits)]]&lt;br /&gt;
Let&#039;s first talk about the simpler sibling of limited direct execution. &#039;&#039;&#039;Direct execution&#039;&#039;&#039; (without limits) simply allows programs to run on the CPU.&lt;br /&gt;
&lt;br /&gt;
This approach, while fast and simple, has problems over &#039;&#039;control&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Restricted operation:&#039;&#039;&#039; How does the OS stop processes from doing things we don&#039;t want it to do?&lt;br /&gt;
* &#039;&#039;&#039;Switching between processes:&#039;&#039;&#039; How does the OS stop an executing process, which is needed for time sharing?&lt;br /&gt;
&lt;br /&gt;
== Limiting operations ==&lt;br /&gt;
There are many things that a user may not want a process to do. For example, performing I/O operations to disks, demanding more system resources, etc. Many functions that we take for granted would be impossible on a direct execution system, an example being limiting disk access to certain programs/users with file permissions.&lt;br /&gt;
&lt;br /&gt;
To limit sensitive operations, most operating systems have two modes: &#039;&#039;&#039;kernel mode&#039;&#039;&#039; and &#039;&#039;&#039;user mode&#039;&#039;&#039;. In kernel mode, all instructions are fair game. In user mode, certain sensitive operations such as I/O and process/resource management would raise an exception.&lt;br /&gt;
&lt;br /&gt;
We want to limit a process&#039; control but still allow them to perform necessary functions. This is done through &#039;&#039;&#039;system calls&#039;&#039;&#039;.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=990</id>
		<title>Limited direct execution</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=990"/>
		<updated>2024-10-02T17:49:00Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Limited direct execution&#039;&#039;&#039; is a technique of allowing programs to partially execute on the CPU directly. This ensures the two necessities of CPU [[virtualization]]: performance and control.&lt;br /&gt;
&lt;br /&gt;
== Direct execution ==&lt;br /&gt;
[[File:OSTEP 6.1.png|thumb|OSTEP: Direct Execution Protocol (Without Limits)]]&lt;br /&gt;
Let&#039;s first talk about the simpler sibling of limited direct execution. &#039;&#039;&#039;Direct execution&#039;&#039;&#039; (without limits) simply allows programs to run on the CPU.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=File:OSTEP_6.1.png&amp;diff=989</id>
		<title>File:OSTEP 6.1.png</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=File:OSTEP_6.1.png&amp;diff=989"/>
		<updated>2024-10-02T17:48:36Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Direct Execution Protocol (Without Limits)&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=988</id>
		<title>Limited direct execution</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Limited_direct_execution&amp;diff=988"/>
		<updated>2024-10-02T17:46:09Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Limited direct execution&amp;#039;&amp;#039;&amp;#039; is a technique of allowing programs to partially execute on the CPU directly. This ensures the two necessities of CPU virtualization: performance and control. Category:Operating System&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Limited direct execution&#039;&#039;&#039; is a technique of allowing programs to partially execute on the CPU directly. This ensures the two necessities of CPU [[virtualization]]: performance and control.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=987</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=987"/>
		<updated>2024-09-30T17:53:05Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more [[Thread|threads]] in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
The syscall &#039;&#039;fork&#039;&#039; clones a process almost perfectly. For example, the child process would not start running at &#039;&#039;main&#039;&#039;; instead, it continues where the parent leaves off. The only differences between the two processes is the return value of &#039;&#039;fork&#039;&#039;: In the parent it is the PID of the child, whereas in the child it is 0. This syscall is notably non-deterministic, as the CPU scheduler is free to run either process before the other.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;wait&#039;&#039; syscall halt execution of the parent until the child is complete.&lt;br /&gt;
&lt;br /&gt;
To run a new process, the &#039;&#039;exec&#039;&#039; syscall can be used. It replaces the current process with that specified in the arguments.&lt;br /&gt;
&lt;br /&gt;
== Motivation of &#039;&#039;fork&#039;&#039; ==&lt;br /&gt;
The motivation behind this unintuitive set of APIs (fork, wait, exec) is to allow the parent process time to alter the environment of the child process.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=986</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=986"/>
		<updated>2024-09-30T17:46:26Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Processes in Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more [[Thread|threads]] in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
The syscall &#039;&#039;fork&#039;&#039; clones a process almost perfectly. For example, the child process would not start running at &#039;&#039;main&#039;&#039;; instead, it continues where the parent leaves off. The only differences between the two processes is the return value of &#039;&#039;fork&#039;&#039;: In the parent it is the PID of the child, whereas in the child it is 0. This syscall is notably non-deterministic, as the CPU scheduler is free to run either process before the other.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;wait&#039;&#039; syscall halt execution of the parent until the child is complete.&lt;br /&gt;
&lt;br /&gt;
To run a new process, the &#039;&#039;exec&#039;&#039; syscall can be used. It replaces the current process with that specified in the arguments.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=985</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=985"/>
		<updated>2024-09-27T18:17:24Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more [[Thread|threads]] in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
&lt;br /&gt;
===== Init process =====&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
===== Creating a process =====&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=984</id>
		<title>Thread</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Thread&amp;diff=984"/>
		<updated>2024-09-27T18:17:09Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;A &amp;#039;&amp;#039;&amp;#039;thread&amp;#039;&amp;#039;&amp;#039; in Computer Science is defined as a sequence of executing instructions from a program. Notably, it is active/running. Category:Operating System&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;thread&#039;&#039;&#039; in Computer Science is defined as a sequence of executing instructions from a program. Notably, it is active/running.&lt;br /&gt;
[[Category:Operating System]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=983</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=983"/>
		<updated>2024-09-27T18:13:24Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action. More formally, it is one or more threads in their own address space.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
&lt;br /&gt;
===== Init process =====&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
===== Creating a process =====&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=982</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Process&amp;diff=982"/>
		<updated>2024-09-26T05:10:07Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
A &#039;&#039;&#039;program&#039;&#039;&#039; is a passive set of machine code instructions and data stored in an executable image. A &#039;&#039;&#039;process&#039;&#039;&#039; can be thought of as this passive program in action.&lt;br /&gt;
&lt;br /&gt;
Processes are independent separate tasks. If one process crashed, it will not affect any other processes. The end goal of processes is to achieve the illusion of having multiple CPUs when executing multiple programs. This is done by &#039;&#039;&#039;virtualization&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Machine state ==&lt;br /&gt;
Representing the execution of a program, a process includes the state of the program first and foremost. This includes&lt;br /&gt;
&lt;br /&gt;
* The [[program counter]]&lt;br /&gt;
* CPU [[Register|registers]]&lt;br /&gt;
* The process [[stack]]&lt;br /&gt;
* The address space&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
Beyond the state of the program, each process is allocated its own process identifier (PID) and [[virtual memory]] among other things.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
The virtualization of CPU&#039;s is what allows more processes than CPU to exist. This is implemented by low-level &#039;&#039;&#039;time-sharing&#039;&#039;&#039; [[Mechanism|mechanisms]]. On top of these mechanisms resides &#039;&#039;&#039;scheduling [[Policy|policies]],&#039;&#039;&#039; which decides which program should run.&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
Typical process APIs include the following:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Create&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Destroy&#039;&#039;&#039; - Killing processes forcefully&lt;br /&gt;
* &#039;&#039;&#039;Wait&#039;&#039;&#039; - Suspend a process to be restarted later&lt;br /&gt;
* &#039;&#039;&#039;Status&#039;&#039;&#039; - Obtain current information of the process&lt;br /&gt;
&lt;br /&gt;
There are many other misc. controls that are possible.&lt;br /&gt;
&lt;br /&gt;
== Process creation ==&lt;br /&gt;
&lt;br /&gt;
# Code and static data are loaded into memory. In modern operating systems, this is done lazily.&lt;br /&gt;
# Allocate memory such as runtime stack and heap&lt;br /&gt;
# Perform initialization tasks, especially those related to I/O.&lt;br /&gt;
# Start the program&lt;br /&gt;
&lt;br /&gt;
== Process state ==&lt;br /&gt;
[[File:Process state transitions.png|thumb|A process&#039; state diagram from Three Pieces textbook]]&lt;br /&gt;
A process has three states&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Running&#039;&#039;&#039; - Its instructions are currently being executed by the CPU&lt;br /&gt;
# &#039;&#039;&#039;Ready&#039;&#039;&#039; - Ready to run but OS is not running it for misc. reasons (such as time-sharing)&lt;br /&gt;
# &#039;&#039;&#039;Blocked&#039;&#039;&#039; - Waiting some I/O to finish, such as requesting a write to disk.&lt;br /&gt;
&lt;br /&gt;
A process is &#039;&#039;&#039;scheduled&#039;&#039;&#039; when the OS moves it from Ready to Running. It is &#039;&#039;&#039;descheduled&#039;&#039;&#039; when it is moved from Running to Ready. This decision is made by the [[scheduler]].&lt;br /&gt;
&lt;br /&gt;
== Processes in Linux ==&lt;br /&gt;
&lt;br /&gt;
===== Init process =====&lt;br /&gt;
When the computer starts, the only thing the kernel execute in the [[user space]] is a init command (shown with ps -f 1). This process is allocated a PID of 1 and is the only process with no parent process.&lt;br /&gt;
&lt;br /&gt;
===== Creating a process =====&lt;br /&gt;
In contrast to the init process, all other processes are created by parent processes. This is done with &#039;&#039;fork&#039;&#039; and &#039;&#039;exec&#039;&#039;. First, the [[shell]] will run &#039;&#039;fork&#039;&#039; to create a cloned process from the current process, and &#039;&#039;exec&#039;&#039; replaces the program in the cloned process with another program.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* Linux documentation: https://tldp.org/LDP/tlk/tlk.html&lt;br /&gt;
* Linux processes, init, fork/exec, ps, kill, fg, bg, jobs: https://www.youtube.com/watch?v=TJzltwv7jJs&lt;br /&gt;
* Operating Systems, Three Easy Pieces&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=File:Process_state_transitions.png&amp;diff=981</id>
		<title>File:Process state transitions.png</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=File:Process_state_transitions.png&amp;diff=981"/>
		<updated>2024-09-26T05:04:07Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Process state diagram&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Modern_physics&amp;diff=980</id>
		<title>Modern physics</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Modern_physics&amp;diff=980"/>
		<updated>2024-09-25T20:17:10Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Modern physics&amp;#039;&amp;#039;&amp;#039; is primarily about the following concepts:  * Special relativity says that the speed of light is constant in all frames, and that time is not the same. * General relativity says that acceleration is indistinguishable from gravity * Interactions are quantized/discrete at a single space-time point, with no action at a distance * Modern physics is fundamentally statistical, whereas classical physics are deterministic.  This includes topics such...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Modern physics&#039;&#039;&#039; is primarily about the following concepts:&lt;br /&gt;
&lt;br /&gt;
* [[Special relativity]] says that the speed of light is constant in all frames, and that time is not the same.&lt;br /&gt;
* [[General relativity]] says that acceleration is indistinguishable from gravity&lt;br /&gt;
* Interactions are quantized/discrete at a single space-time point, with no action at a distance&lt;br /&gt;
* Modern physics is fundamentally statistical, whereas classical physics are deterministic.&lt;br /&gt;
&lt;br /&gt;
This includes topics such as special/general relativity, quantum mechanics, statistical physics, nuclear physics, and fundamental particles.&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=979</id>
		<title>Object relationship</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=979"/>
		<updated>2024-08-10T02:21:05Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= IMPORTANT NOTE: This page may be wrong since I am confused. =&lt;br /&gt;
In [[OOP]], interrelated objects are composed together for complex functionality. This page describes concepts that relate one object to another.&lt;br /&gt;
&lt;br /&gt;
= Inheritance =&lt;br /&gt;
Implementation inheritance extends the implementation of a parent class with a child class that inherit the members of the parent class while adding/overriding certain members.&lt;br /&gt;
&lt;br /&gt;
= Composition =&lt;br /&gt;
Unlike [[Object relationship#Inheritance|inheritance]], which directly extends a parent object, composition owns the object whose functionality it wishes to extend. This solves many of the issues of inheritance.&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
class Owner&lt;br /&gt;
{&lt;br /&gt;
    Extended ext;&lt;br /&gt;
&lt;br /&gt;
  public:&lt;br /&gt;
    Owner() {&lt;br /&gt;
        ext = Extended();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Aggregation =&lt;br /&gt;
Similar to [[Object relationship#Composition|composition]], aggregation involves an object &amp;quot;having&amp;quot; another object. The difference between the two lies in that composition focuses on a parent-child relationship, whereas Aggregation&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=978</id>
		<title>Object relationship</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=978"/>
		<updated>2024-08-08T17:51:44Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[OOP]], interrelated objects are composed together for complex functionality. This page describes concepts that relate one object to another.&lt;br /&gt;
&lt;br /&gt;
= Inheritance =&lt;br /&gt;
Implementation inheritance extends the implementation of a parent class with a child class that inherit the members of the parent class while adding/overriding certain members.&lt;br /&gt;
&lt;br /&gt;
= Composition =&lt;br /&gt;
Unlike [[Object relationship#Inheritance|inheritance]], which directly extends a parent object, composition owns the object whose functionality it wishes to extend. This solves many of the issues of inheritance.&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
class Owner&lt;br /&gt;
{&lt;br /&gt;
    Extended ext;&lt;br /&gt;
&lt;br /&gt;
  public:&lt;br /&gt;
    Owner() {&lt;br /&gt;
        ext = Extended();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Aggregation =&lt;br /&gt;
Similar to [[Object relationship#Composition|composition]], aggregation involves an object &amp;quot;having&amp;quot; another object. The difference between the two lies in that composition focuses on a parent-child relationship, whereas Aggregation&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=977</id>
		<title>Object relationship</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Object_relationship&amp;diff=977"/>
		<updated>2024-08-08T16:18:04Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;In OOP, interrelated objects are composed together for complex functionality. This page describes concepts that relate one object to another.  = Inheritance =  = Composition =  = Aggregation = Unlike&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[OOP]], interrelated objects are composed together for complex functionality. This page describes concepts that relate one object to another.&lt;br /&gt;
&lt;br /&gt;
= Inheritance =&lt;br /&gt;
&lt;br /&gt;
= Composition =&lt;br /&gt;
&lt;br /&gt;
= Aggregation =&lt;br /&gt;
Unlike&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Category:Object_Oriented_Programming&amp;diff=976</id>
		<title>Category:Object Oriented Programming</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Category:Object_Oriented_Programming&amp;diff=976"/>
		<updated>2024-08-08T16:14:14Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;OOP&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OOP&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Relational_model&amp;diff=975</id>
		<title>Relational model</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Relational_model&amp;diff=975"/>
		<updated>2024-07-20T23:19:19Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;relational model&amp;#039;&amp;#039;&amp;#039; is a data model that stores data in a simple data structure called a &amp;#039;&amp;#039;&amp;#039;relation&amp;#039;&amp;#039;&amp;#039;.  == Relation == Essentially a table. It stores entries (rows) of related attributes (columns).  For example, let&amp;#039;s say we want to store a student&amp;#039;s data. This student is considered one entry in the student database. In this entry is the student&amp;#039;s full name, home address, and GPA, which are attributes that relate to each other because they are from...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;relational model&#039;&#039;&#039; is a [[Database|data model]] that stores data in a simple data structure called a &#039;&#039;&#039;relation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Relation ==&lt;br /&gt;
Essentially a table. It stores entries (rows) of related attributes (columns).&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s say we want to store a student&#039;s data. This student is considered one entry in the student database. In this entry is the student&#039;s full name, home address, and GPA, which are attributes that relate to each other because they are from the same student.&lt;br /&gt;
&lt;br /&gt;
=== Primary key ===&lt;br /&gt;
In each relation, an attribute is used as the &#039;&#039;&#039;primary key&#039;&#039;&#039;. This is the unique identifier of each entry.&lt;br /&gt;
&lt;br /&gt;
== Operations ==&lt;br /&gt;
The relational model specifies the following operations to be performed on the database.&lt;br /&gt;
&lt;br /&gt;
=== Select ===&lt;br /&gt;
The &#039;&#039;&#039;select&#039;&#039;&#039; operator selects a subset of entries from a relation with a criteria.&lt;br /&gt;
&lt;br /&gt;
In conjunction with the primary key, it allows the user to select a particular entry inside the database.&lt;br /&gt;
&lt;br /&gt;
=== Permutation ===&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=974</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=974"/>
		<updated>2024-07-20T23:08:49Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Relational model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; stores, retrieves, and operates on a collection of related data. A &#039;&#039;&#039;database management system (DBMS)&#039;&#039;&#039; is a general way to implement databases. This page will describe why we want a system specifically for this task, a high-level breakdown of its functionality, as well as an overview of how it is implemented.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
A separate system for the management of collections of data is necessary because of two things: 1) the task&#039;s prevalence in many application, and 2) the difficulty to implement such a system correctly and efficiently. The former point is relatively intuitive, but the second point is more involved.&lt;br /&gt;
&lt;br /&gt;
To design a way to manage collections of data is to solve the following problems among many.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Data integrity&#039;&#039;&#039;: Ensure that data stored is valid and will not cause errors upon operation and/or retrieval. Examples include type checking.&lt;br /&gt;
* &#039;&#039;&#039;Efficient implementation:&#039;&#039;&#039; Implementation needs to be efficient for the task at hand. Examples include data structures and concurrency.&lt;br /&gt;
* &#039;&#039;&#039;Durability:&#039;&#039;&#039; Ensure the safety of the data during system errors and modifications. Examples include computer crashing.&lt;br /&gt;
&lt;br /&gt;
All of the above tasks are highly involved. As such, a layer of abstraction is very beneficial for development: you don&#039;t want to handle all of these problems when building your project!&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
The role of a general-purpose DBMS is to handle the definition, creation, querying, update, and administration of databases. DBMSes are widely tested and deployed, and as such allow developers to focus on other aspects of their program and rely on DBMSes to store the data.&lt;br /&gt;
&lt;br /&gt;
== Data models ==&lt;br /&gt;
A &#039;&#039;&#039;data model&#039;&#039;&#039; is a collection of concepts that describes how data is represented in the database.&lt;br /&gt;
&lt;br /&gt;
=== [[Relational model]] ===&lt;br /&gt;
The &#039;&#039;&#039;relational model&#039;&#039;&#039; abstracts away database implementation by allowing developers to access data through a high-level language, where the DBMS decides the strategy. It stores data in a simple structure called a &#039;&#039;&#039;relation&#039;&#039;&#039;, and the physical implementation of the database is handled by the DBMS.&lt;br /&gt;
&lt;br /&gt;
The relational model is known for its flexibility, and is the most frequently used model to this day.&lt;br /&gt;
&lt;br /&gt;
=== [[NoSQL]] ===&lt;br /&gt;
&#039;&#039;&#039;NoSQL&#039;&#039;&#039; is a diverse category of data models. The following list some examples.&lt;br /&gt;
&lt;br /&gt;
* Key/Value&lt;br /&gt;
* Graph&lt;br /&gt;
* Document&lt;br /&gt;
* Column-family&lt;br /&gt;
&lt;br /&gt;
=== Other models ===&lt;br /&gt;
&lt;br /&gt;
* Array/Matrix is useful for machine learning applications&lt;br /&gt;
* Hierarchical, network, multi-value is used in legacy systems.&lt;br /&gt;
{{Database sources}}&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=973</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=973"/>
		<updated>2024-07-20T23:03:20Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Relational model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; stores, retrieves, and operates on a collection of related data. A &#039;&#039;&#039;database management system (DBMS)&#039;&#039;&#039; is a general way to implement databases. This page will describe why we want a system specifically for this task, a high-level breakdown of its functionality, as well as an overview of how it is implemented.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
A separate system for the management of collections of data is necessary because of two things: 1) the task&#039;s prevalence in many application, and 2) the difficulty to implement such a system correctly and efficiently. The former point is relatively intuitive, but the second point is more involved.&lt;br /&gt;
&lt;br /&gt;
To design a way to manage collections of data is to solve the following problems among many.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Data integrity&#039;&#039;&#039;: Ensure that data stored is valid and will not cause errors upon operation and/or retrieval. Examples include type checking.&lt;br /&gt;
* &#039;&#039;&#039;Efficient implementation:&#039;&#039;&#039; Implementation needs to be efficient for the task at hand. Examples include data structures and concurrency.&lt;br /&gt;
* &#039;&#039;&#039;Durability:&#039;&#039;&#039; Ensure the safety of the data during system errors and modifications. Examples include computer crashing.&lt;br /&gt;
&lt;br /&gt;
All of the above tasks are highly involved. As such, a layer of abstraction is very beneficial for development: you don&#039;t want to handle all of these problems when building your project!&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
The role of a general-purpose DBMS is to handle the definition, creation, querying, update, and administration of databases. DBMSes are widely tested and deployed, and as such allow developers to focus on other aspects of their program and rely on DBMSes to store the data.&lt;br /&gt;
&lt;br /&gt;
== Models ==&lt;br /&gt;
&lt;br /&gt;
=== [[Relational model]] ===&lt;br /&gt;
The &#039;&#039;&#039;relational model&#039;&#039;&#039; abstracts away database implementation by allowing developers to access data through a high-level language, where the DBMS decides the strategy. It stores data in a simple structure called a &#039;&#039;&#039;relation&#039;&#039;&#039;, and the physical implementation of the database is handled by the DBMS.&lt;br /&gt;
&lt;br /&gt;
{{Database sources}}&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=972</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=972"/>
		<updated>2024-07-20T23:02:51Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; stores, retrieves, and operates on a collection of related data. A &#039;&#039;&#039;database management system (DBMS)&#039;&#039;&#039; is a general way to implement databases. This page will describe why we want a system specifically for this task, a high-level breakdown of its functionality, as well as an overview of how it is implemented.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
A separate system for the management of collections of data is necessary because of two things: 1) the task&#039;s prevalence in many application, and 2) the difficulty to implement such a system correctly and efficiently. The former point is relatively intuitive, but the second point is more involved.&lt;br /&gt;
&lt;br /&gt;
To design a way to manage collections of data is to solve the following problems among many.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Data integrity&#039;&#039;&#039;: Ensure that data stored is valid and will not cause errors upon operation and/or retrieval. Examples include type checking.&lt;br /&gt;
* &#039;&#039;&#039;Efficient implementation:&#039;&#039;&#039; Implementation needs to be efficient for the task at hand. Examples include data structures and concurrency.&lt;br /&gt;
* &#039;&#039;&#039;Durability:&#039;&#039;&#039; Ensure the safety of the data during system errors and modifications. Examples include computer crashing.&lt;br /&gt;
&lt;br /&gt;
All of the above tasks are highly involved. As such, a layer of abstraction is very beneficial for development: you don&#039;t want to handle all of these problems when building your project!&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
The role of a general-purpose DBMS is to handle the definition, creation, querying, update, and administration of databases. DBMSes are widely tested and deployed, and as such allow developers to focus on other aspects of their program and rely on DBMSes to store the data.&lt;br /&gt;
&lt;br /&gt;
== Models ==&lt;br /&gt;
&lt;br /&gt;
=== [[Relational model]] ===&lt;br /&gt;
The &#039;&#039;&#039;relational model&#039;&#039;&#039; abstracts away database implementation by allowing developers to access data through a high-level language, where the DBMS decides the strategy. It stores data in a simple structure called a &#039;&#039;&#039;relation&#039;&#039;&#039;, and the physical implementation of the database is handled by the DBMS.{{Database sources}}&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=971</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=971"/>
		<updated>2024-07-20T22:58:03Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; stores, retrieves, and operates on a collection of related data. A &#039;&#039;&#039;database management system (DBMS)&#039;&#039;&#039; is a general way to implement databases. This page will describe why we want a system specifically for this task, a high-level breakdown of its functionality, as well as an overview of how it is implemented.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
A separate system for the management of collections of data is necessary because of two things: 1) the task&#039;s prevalence in many application, and 2) the difficulty to implement such a system correctly and efficiently. The former point is relatively intuitive, but the second point is more involved.&lt;br /&gt;
&lt;br /&gt;
To design a way to manage collections of data is to solve the following problems among many.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Data integrity&#039;&#039;&#039;: Ensure that data stored is valid and will not cause errors upon operation and/or retrieval. Examples include type checking.&lt;br /&gt;
* &#039;&#039;&#039;Efficient implementation:&#039;&#039;&#039; Implementation needs to be efficient for the task at hand. Examples include data structures and concurrency.&lt;br /&gt;
* &#039;&#039;&#039;Durability:&#039;&#039;&#039; Ensure the safety of the data during system errors and modifications. Examples include computer crashing.&lt;br /&gt;
&lt;br /&gt;
All of the above tasks are highly involved. As such, a layer of abstraction is very beneficial for development: you don&#039;t want to handle all of these problems when building your project!&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
The role of a general-purpose DBMS is to handle the definition, creation, querying, update, and administration of databases&lt;br /&gt;
{{Database sources}}&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=970</id>
		<title>Template:Database sources</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=970"/>
		<updated>2024-07-20T22:53:34Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Sources =&lt;br /&gt;
Information about databases on this wiki come from the following sources:&lt;br /&gt;
* [https://www.youtube.com/watch?v=v4bU6n97Vr8&amp;amp;list=PLSE8ODhjZXjZaHA6QcxDfJ0SIWBzQFKEG&amp;amp;index=1 CMU public lecture on YouTube]&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Sources]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=969</id>
		<title>Template:Database sources</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=969"/>
		<updated>2024-07-20T22:53:01Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Sources =&lt;br /&gt;
Information about databases on this wiki come from the following sources:&lt;br /&gt;
* [https://www.youtube.com/watch?v=v4bU6n97Vr8&amp;amp;list=PLSE8ODhjZXjZaHA6QcxDfJ0SIWBzQFKEG&amp;amp;index=1 CMU public lecture on YouTube]&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=968</id>
		<title>Template:Database sources</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Template:Database_sources&amp;diff=968"/>
		<updated>2024-07-20T22:52:49Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;# Sources Information about databases on this wiki come from the following sources: * [https://www.youtube.com/watch?v=v4bU6n97Vr8&amp;amp;list=PLSE8ODhjZXjZaHA6QcxDfJ0SIWBzQFKEG&amp;amp;index=1 CMU public lecture on YouTube] Category:Computer Science&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;# Sources&lt;br /&gt;
Information about databases on this wiki come from the following sources:&lt;br /&gt;
* [https://www.youtube.com/watch?v=v4bU6n97Vr8&amp;amp;list=PLSE8ODhjZXjZaHA6QcxDfJ0SIWBzQFKEG&amp;amp;index=1 CMU public lecture on YouTube]&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=967</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=967"/>
		<updated>2024-07-20T22:49:51Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database management system (DBMS)&#039;&#039;&#039; is a system that stores, retrieves, and operates on a collection of related data. This page will describe why we want a system specifically for this task, a high-level breakdown of its functionality, as well as an overview of how it is implemented.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
A separate system for the management of collections of data is necessary because of two things: 1) the task&#039;s prevalence in many application, and 2) the difficulty to implement such a system correctly and efficiently. The former point is relatively intuitive, but the second point is more involved.&lt;br /&gt;
&lt;br /&gt;
To design a way to manage collections of data is to solve the following problems among many.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Data integrity&#039;&#039;&#039;: Ensure that data stored is valid and will not cause errors upon operation and/or retrieval. Examples include type checking.&lt;br /&gt;
* &#039;&#039;&#039;Efficient implementation:&#039;&#039;&#039; Implementation needs to be efficient for the task at hand. Examples include data structures and concurrency.&lt;br /&gt;
* &#039;&#039;&#039;Durability:&#039;&#039;&#039; Ensure the safety of the data during system errors and modifications. Examples include computer crashing.&lt;br /&gt;
&lt;br /&gt;
As such, it is unproductive to do this for every application.&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=966</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=966"/>
		<updated>2024-07-20T22:36:55Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; is a system that stores, retrieves, and operates on a collection of related data.&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=965</id>
		<title>Database</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Database&amp;diff=965"/>
		<updated>2024-07-20T22:36:35Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;A &amp;#039;&amp;#039;&amp;#039;database&amp;#039;&amp;#039;&amp;#039; is a system that stores, retrieves, and operates on a collection of related data efficiently. Category:Computer Science&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;database&#039;&#039;&#039; is a system that stores, retrieves, and operates on a collection of related data efficiently.&lt;br /&gt;
[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=964</id>
		<title>Diffusion model</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=964"/>
		<updated>2024-07-05T23:08:24Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In a nutshell, &#039;&#039;&#039;diffusion models&#039;&#039;&#039; work by making something more random/noisy, and through the process finding the inverse, which is making noisy things less random, thus generating data.&lt;br /&gt;
&lt;br /&gt;
Diffusion models are frequently used for computer vision tasks such as text-to-image. This page will focus exclusively on that use case.&lt;br /&gt;
&lt;br /&gt;
== Principle ==&lt;br /&gt;
More specifically, diffusion models consists of two steps: &#039;&#039;forward&#039;&#039; &#039;&#039;diffusion&#039;&#039;, which turns an image into noise, and &#039;&#039;backward diffusion&#039;&#039;, which turns noise back into an image.&lt;br /&gt;
&lt;br /&gt;
=== Forward diffusion ===&lt;br /&gt;
Mathematically, each step of the forward diffusion process is defined as &amp;lt;math&amp;gt;q(x_t|x_{t-1})=\mathcal{N}(x_t, \sqrt{1-\beta_t}x_{t-1} , \beta_tI)&amp;lt;/math&amp;gt;, where &#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039; is the process output at step &#039;&#039;t&#039;&#039;, &#039;&#039;q&#039;&#039; is a distribution at the current step depending on the previous step, &#039;&#039;N&#039;&#039; is a [[multivariate normal distribution]], the square root is the mean, and the last one being the variance.&lt;br /&gt;
&lt;br /&gt;
Explained more textually, the process generates a probability distribution of the current step (&#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039;) given the last step. The distribution is normal, with randomness injected by a schedule. The image starts with a non-random distribution, and through this process we destroy that distribution into noise. In real scenarios, the noise is not added iteratively, but this is the principle.&lt;br /&gt;
&lt;br /&gt;
==== Schedule ====&lt;br /&gt;
&#039;&#039;Beta t&#039;&#039; is the hyperparameter called &#039;&#039;schedule&#039;&#039;. It increases w.r.t. time step &#039;&#039;t&#039;&#039; and controls the variance of the distribution during the forward process. It is a value ranging from 0 to 1, and as a result, it brings the mean of the gaussian closer to 0 and the variance closer to &#039;&#039;I&#039;&#039;, which is the goal of the forward process.&lt;br /&gt;
&lt;br /&gt;
We want a small schedule such that learning how to undo it isn&#039;t too difficult.&lt;br /&gt;
&lt;br /&gt;
==== Noising process ====&lt;br /&gt;
Thus, the entire noise added at time step &#039;&#039;T&#039;&#039; is defined to be &amp;lt;math&amp;gt;q(x_{1:T} |x_0)=\prod^T_{t=i}q(x_t|x_{t-1})&amp;lt;/math&amp;gt;, coming form probability.&lt;br /&gt;
&lt;br /&gt;
With the derivation in source 1, we can simplify it to a single equation instead of an iterative process, significantly speeding up the algorithm.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
# https://erdem.pl/2023/11/step-by-step-visual-introduction-to-diffusion-models&lt;br /&gt;
# [https://www.youtube.com/watch?v=fbLgFrlTnGU&amp;amp;t=75s https://www.youtube.com/watch?v=fbLgFrlTnGU] &lt;br /&gt;
&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Machine Learning]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=963</id>
		<title>Diffusion model</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=963"/>
		<updated>2024-07-05T23:06:48Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In a nutshell, &#039;&#039;&#039;diffusion models&#039;&#039;&#039; work by making something more random/noisy, and through the process finding the inverse, which is making noisy things less random, thus generating data.&lt;br /&gt;
&lt;br /&gt;
Diffusion models are frequently used for computer vision tasks such as text-to-image. This page will focus exclusively on that use case.&lt;br /&gt;
&lt;br /&gt;
== Principle ==&lt;br /&gt;
More specifically, diffusion models consists of two steps: &#039;&#039;forward&#039;&#039; &#039;&#039;diffusion&#039;&#039;, which turns an image into noise, and &#039;&#039;backward diffusion&#039;&#039;, which turns noise back into an image.&lt;br /&gt;
&lt;br /&gt;
=== Forward diffusion ===&lt;br /&gt;
Mathematically, each step of the forward diffusion process is defined as &amp;lt;math&amp;gt;q(x_t|x_{t-1})=\mathcal{N}(x_t, \sqrt{1-\beta_t}x_{t-1} , \beta_tI)&amp;lt;/math&amp;gt;, where &#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039; is the process output at step &#039;&#039;t&#039;&#039;, &#039;&#039;q&#039;&#039; is a distribution at the current step depending on the previous step, &#039;&#039;N&#039;&#039; is a [[multivariate normal distribution]], the square root is the mean, and the last one being the variance.&lt;br /&gt;
&lt;br /&gt;
Explained more textually, the process generates a probability distribution of the current step (&#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039;) given the last step. The distribution is normal, with randomness injected by a schedule. The image starts with a non-random distribution, and through this process we destroy that distribution into noise. In real scenarios, the noise is not added iteratively, but this is the principle.&lt;br /&gt;
&lt;br /&gt;
==== Schedule ====&lt;br /&gt;
&#039;&#039;Beta t&#039;&#039; is the hyperparameter called &#039;&#039;schedule&#039;&#039;. It increases w.r.t. time step &#039;&#039;t&#039;&#039; and controls the variance of the distribution during the forward process. It is a value ranging from 0 to 1, and as a result, it brings the mean of the gaussian closer to 0 and the variance closer to &#039;&#039;I&#039;&#039;, which is the goal of the forward process.&lt;br /&gt;
&lt;br /&gt;
We want a small schedule such that learning how to undo it isn&#039;t too difficult.&lt;br /&gt;
&lt;br /&gt;
==== Noising process ====&lt;br /&gt;
Thus, the entire noise added at time step &#039;&#039;T&#039;&#039; is defined to be &amp;lt;math&amp;gt;q(x_{1:T} |x_0)=\prod^T_{t=i}q(x_t|x_{t-1})&amp;lt;/math&amp;gt;, coming form probability.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://erdem.pl/2023/11/step-by-step-visual-introduction-to-diffusion-models&lt;br /&gt;
* [https://www.youtube.com/watch?v=fbLgFrlTnGU&amp;amp;t=75s https://www.youtube.com/watch?v=fbLgFrlTnGU] &lt;br /&gt;
&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Machine Learning]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=962</id>
		<title>Entity relationship diagram</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=962"/>
		<updated>2024-07-05T01:21:43Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
As the name suggests, an &#039;&#039;&#039;entity relationship diagram (ERD)&#039;&#039;&#039; shows &#039;&#039;&#039;entities&#039;&#039;&#039;, their properties, and their relationships with other entities. It is the industry standard used to illustrate [[Relational database|relational databases]] graphically.&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
The core of an ERD is the &#039;&#039;entity&#039;&#039;. It is a definable &amp;quot;thing&amp;quot; that stores information.&lt;br /&gt;
&lt;br /&gt;
Both &#039;&#039;entity types&#039;&#039; and &#039;&#039;entity sets&#039;&#039; are groups of definable things. However, entity types are time-independent, whereas entity sets are entity types at a particular interval of time. &#039;&#039;An entity is an instance of an entity type&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Entity categories ===&lt;br /&gt;
Entities are categorized into strong, weak, and associative. A &#039;&#039;strong&#039;&#039; entity can be defined solely by its properties, making it unique to other strong entities of the same type, whereas a weak one cannot be defined solely by its properties and is usually tied to a strong entity. The difference can be thought of as one having a key and the other not having one.&lt;br /&gt;
&lt;br /&gt;
In contrast to the distinction between strong and weak by the uniqueness of an entity in its type, an associative entity is used to describe an association (relationship) between entities. Think of it as weak entities with multiple parents.&lt;br /&gt;
[[File:ERD Cardinality.png|thumb|Figure 1. Cardinality diagram sourced from lucidchart]]&lt;br /&gt;
&lt;br /&gt;
=== Cardinality ===&lt;br /&gt;
Lines are used to represent relationships between entity types in an ERD, and the &#039;&#039;cardinality&#039;&#039; of the relationship further describes that relationship in terms of the number on each side. Figure 1 illustrates all cardinality lines.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://www.lucidchart.com/pages/er-diagrams&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=File:ERD_Cardinality.png&amp;diff=961</id>
		<title>File:ERD Cardinality.png</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=File:ERD_Cardinality.png&amp;diff=961"/>
		<updated>2024-07-05T01:21:13Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Diagram of cardinality from https://www.lucidchart.com/pages/er-diagrams&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=960</id>
		<title>Entity relationship diagram</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=960"/>
		<updated>2024-07-05T01:17:34Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
As the name suggests, an &#039;&#039;&#039;entity relationship diagram (ERD)&#039;&#039;&#039; shows &#039;&#039;&#039;entities&#039;&#039;&#039;, their properties, and their relationships with other entities. It is the industry standard used to illustrate [[Relational database|relational databases]] graphically.&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
The core of an ERD is the &#039;&#039;entity&#039;&#039;. It is a definable &amp;quot;thing&amp;quot; that stores information.&lt;br /&gt;
&lt;br /&gt;
Both &#039;&#039;entity types&#039;&#039; and &#039;&#039;entity sets&#039;&#039; are groups of definable things. However, entity types are time-independent, whereas entity sets are entity types at a particular interval of time. &#039;&#039;An entity is an instance of an entity type&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Entity categories ===&lt;br /&gt;
Entities are categorized into strong, weak, and associative. A &#039;&#039;strong&#039;&#039; entity can be defined solely by its properties, making it unique to other strong entities of the same type, whereas a weak one cannot be defined solely by its properties and is usually tied to a strong entity. The difference can be thought of as one having a key and the other not having one.&lt;br /&gt;
&lt;br /&gt;
In contrast to the distinction between strong and weak by the uniqueness of an entity in its type, an associative entity is used to describe an association (relationship) between entities. Think of it as weak entities with multiple parents.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://www.lucidchart.com/pages/er-diagrams&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=959</id>
		<title>Entity relationship diagram</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=959"/>
		<updated>2024-07-05T00:54:20Z</updated>

		<summary type="html">&lt;p&gt;Rice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;br /&gt;
As the name suggests, an &#039;&#039;&#039;entity relationship diagram&#039;&#039;&#039; shows &#039;&#039;&#039;entities&#039;&#039;&#039;, their properties, and their relationships with other entities. It is often used to illustrate relational databases graphically.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://www.lucidchart.com/pages/er-diagrams&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=958</id>
		<title>Entity relationship diagram</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Entity_relationship_diagram&amp;diff=958"/>
		<updated>2024-07-05T00:52:17Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;Category:Computer Science&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Computer Science]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=ERD&amp;diff=957</id>
		<title>ERD</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=ERD&amp;diff=957"/>
		<updated>2024-07-05T00:52:00Z</updated>

		<summary type="html">&lt;p&gt;Rice: Redirected page to Entity relationship diagram&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Entity relationship diagram]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=956</id>
		<title>Diffusion model</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=956"/>
		<updated>2024-07-05T00:37:48Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Forward diffusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In a nutshell, &#039;&#039;&#039;diffusion models&#039;&#039;&#039; work by making something more random/noisy, and through the process finding the inverse, which is making noisy things less random, thus generating data.&lt;br /&gt;
&lt;br /&gt;
Diffusion models are frequently used for computer vision tasks such as text-to-image. This page will focus exclusively on that use case.&lt;br /&gt;
&lt;br /&gt;
== Principle ==&lt;br /&gt;
More specifically, diffusion models consists of two steps: &#039;&#039;forward&#039;&#039; &#039;&#039;diffusion&#039;&#039;, which turns an image into noise, and &#039;&#039;backward diffusion&#039;&#039;, which turns noise back into an image.&lt;br /&gt;
&lt;br /&gt;
=== Forward diffusion ===&lt;br /&gt;
Mathematically, each step of the forward diffusion process is defined as &amp;lt;math&amp;gt;q(x_t|x_{t-1})=\mathcal{N}(x_t, \sqrt{1-\beta_t}x_{t-1} , \beta_tI)&amp;lt;/math&amp;gt;, where &#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039; is the process output at step &#039;&#039;t&#039;&#039;, &#039;&#039;q&#039;&#039; is a distribution at the current step depending on the previous step, &#039;&#039;N&#039;&#039; is a [[multivariate normal distribution]], the square root is the mean, and the last one being the variance.&lt;br /&gt;
&lt;br /&gt;
Explained more textually, the process generates a probability distribution of the current step (&#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039;) given the last step. The distribution is normal, with randomness injected by a schedule. The image starts with a non-random distribution, and through this process we destroy that distribution into noise. In real scenarios, the noise is not added iteratively, but this is the principle.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://erdem.pl/2023/11/step-by-step-visual-introduction-to-diffusion-models &lt;br /&gt;
&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Machine Learning]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Covariance&amp;diff=955</id>
		<title>Covariance</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Covariance&amp;diff=955"/>
		<updated>2024-07-05T00:37:25Z</updated>

		<summary type="html">&lt;p&gt;Rice: Redirected page to Bivariate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Bivariate]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Multivariate_normal_distribution&amp;diff=954</id>
		<title>Multivariate normal distribution</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Multivariate_normal_distribution&amp;diff=954"/>
		<updated>2024-07-05T00:21:38Z</updated>

		<summary type="html">&lt;p&gt;Rice: Created page with &amp;quot;A &amp;#039;&amp;#039;&amp;#039;multivariate normal distribution&amp;#039;&amp;#039;&amp;#039; is the normal distribution generalized into higher dimensions.  == Definitions == The distribution is written as &amp;lt;math&amp;gt;\mathbf{x}\sim \mathcal{N} _k(\boldsymbol\mu,\, \boldsymbol\Sigma )&amp;lt;/math&amp;gt;, where mu is a k-vector mean and sigma is the covariance matrix.  = Sources =  * https://en.wikipedia.org/wiki/Multivariate_normal_distribution  Category:Statistics&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;multivariate normal distribution&#039;&#039;&#039; is the [[normal distribution]] generalized into higher dimensions.&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
The distribution is written as &amp;lt;math&amp;gt;\mathbf{x}\sim \mathcal{N} _k(\boldsymbol\mu,\, \boldsymbol\Sigma )&amp;lt;/math&amp;gt;, where mu is a k-vector mean and sigma is the [[covariance]] matrix.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://en.wikipedia.org/wiki/Multivariate_normal_distribution&lt;br /&gt;
&lt;br /&gt;
[[Category:Statistics]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
	<entry>
		<id>http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=953</id>
		<title>Diffusion model</title>
		<link rel="alternate" type="text/html" href="http://ricefriedegg.com:80/mediawiki/index.php?title=Diffusion_model&amp;diff=953"/>
		<updated>2024-07-05T00:15:03Z</updated>

		<summary type="html">&lt;p&gt;Rice: /* Forward diffusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In a nutshell, &#039;&#039;&#039;diffusion models&#039;&#039;&#039; work by making something more random/noisy, and through the process finding the inverse, which is making noisy things less random, thus generating data.&lt;br /&gt;
&lt;br /&gt;
Diffusion models are frequently used for computer vision tasks such as text-to-image. This page will focus exclusively on that use case.&lt;br /&gt;
&lt;br /&gt;
== Principle ==&lt;br /&gt;
More specifically, diffusion models consists of two steps: &#039;&#039;forward&#039;&#039; &#039;&#039;diffusion&#039;&#039;, which turns an image into noise, and &#039;&#039;backward diffusion&#039;&#039;, which turns noise back into an image.&lt;br /&gt;
&lt;br /&gt;
=== Forward diffusion ===&lt;br /&gt;
Mathematically, each step of the forward diffusion process is defined as &amp;lt;math&amp;gt;q(x_t|x_{t-1})=N(x_t, \sqrt{1-\beta_t}x_{t-1} , \beta_tI)&amp;lt;/math&amp;gt;, where &#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039; is the process output at step &#039;&#039;t&#039;&#039;, &#039;&#039;q&#039;&#039; is a distribution at the current step depending on the previous step, &#039;&#039;N&#039;&#039; is a [[multivariate normal distribution]], the square root is the mean, and the last one being the variance.&lt;br /&gt;
&lt;br /&gt;
Explained more textually, the process generates a probability distribution of the current step (&#039;&#039;x&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&#039;&#039;) given the last step. The distribution is normal, with randomness injected by a schedule. The image starts with a non-random distribution, and through this process we destroy that distribution into noise. In real scenarios, the noise is not added iteratively, but this is the principle.&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://erdem.pl/2023/11/step-by-step-visual-introduction-to-diffusion-models &lt;br /&gt;
&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Machine Learning]]&lt;/div&gt;</summary>
		<author><name>Rice</name></author>
	</entry>
</feed>