templeos-info/public/Wb/Home/Doc/MultiCore.DD.HTML

54 lines
4.0 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>TempleOS does master-slave multicore instead of SMP. </span><span class=cF2>Core0</span><span class=cF0> is the master. The
<a name="l2"></a>master core's applications explicitly assign computational jobs to other cores
<a name="l3"></a>and the TempleOS scheduler does not move tasks between cores.
<a name="l4"></a>
<a name="l5"></a>There are multicore safe locks for file access and heap allocations, however, so
<a name="l6"></a>TempleOS is symmetrical in some sense. See </span><a href="/Wb/Demo/MultiCore/LoadTest.HC.HTML#l1"><span class=cF4>::/Demo/MultiCore/LoadTest.HC</span></a><span class=cF0>.
<a name="l7"></a>
<a name="l8"></a>Only tasks on </span><span class=cF2>Core0</span><span class=cF0> can have windows, but other cores can help render them.
<a name="l9"></a>
<a name="l10"></a>Each core has an executive </span><a href="/Wb/Doc/Glossary.DD.HTML#l181"><span class=cF4>Seth Task</span></a><span class=cF0> which is the father of all tasks on that
<a name="l11"></a>core. </span><a href="/Wb/Doc/Glossary.DD.HTML#l171"><span class=cF4>Adam</span></a><span class=cF0> is the </span><a href="/Wb/Doc/Glossary.DD.HTML#l181"><span class=cF4>Seth Task</span></a><span class=cF0> on </span><span class=cF2>Core0</span><span class=cF0>.
<a name="l12"></a>
<a name="l13"></a>You give a job to a </span><a href="/Wb/Doc/Glossary.DD.HTML#l181"><span class=cF4>Seth Task</span></a><span class=cF0> with </span><a href="/Wb/Kernel/MultiProc.HC.HTML#l213"><span class=cF4>JobQue</span></a><span class=cF0>() and get the result with </span><a href="/Wb/Kernel/Job.HC.HTML#l199"><span class=cF4>JobResGet</span></a><span class=cF0>().
<a name="l14"></a> You spawn a task on any core with </span><a href="/Wb/Kernel/KTask.HC.HTML#l242"><span class=cF4>Spawn</span></a><span class=cF0>().
<a name="l15"></a>
<a name="l16"></a>Note: You must use the </span><span class=cF2>LOCK</span><span class=cF0> asm prefix when changing shared structures in a
<a name="l17"></a>multicore environment. The </span><a href="/Wb/Kernel/KernelB.HH.HTML#l26"><span class=cF4>LBts</span></a><span class=cF0>(), </span><a href="/Wb/Kernel/KernelB.HH.HTML#l24"><span class=cF4>LBtr</span></a><span class=cF0>() and </span><a href="/Wb/Kernel/KernelB.HH.HTML#l22"><span class=cF4>LBtc</span></a><span class=cF0>() insts have </span><span class=cF2>LOCK</span><span class=cF0> prefixes.
<a name="l18"></a>The compiler has a </span><span class=cF2>lock{}</span><span class=cF0> feature but it doesn't work well. See </span><span class=cF4>
<a name="l19"></a></span><a href="/Wb/Demo/MultiCore/Lock.HC.HTML#l1"><span class=cF4>::/Demo/MultiCore/Lock.HC</span></a><span class=cF0>.
<a name="l20"></a>
<a name="l21"></a>See </span><a href="/Wb/Demo/Graphics/Transform.HC.HTML#l1"><span class=cF4>::/Demo/Graphics/Transform.HC</span></a><span class=cF0>.
<a name="l22"></a>See </span><a href="/Wb/Kernel/MultiProc.HC.HTML#l1"><span class=cF4>::/Kernel/MultiProc.HC</span></a><span class=cF0>.
</span></pre></body>
</html>