⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resource arbitration and power management - tinyos documentation wiki.htm

📁 从官方网站上下载tinyos2.0的学习指南
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0074)http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management -->
<HTML lang=en dir=ltr xml:lang="en" 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Resource Arbitration and Power Management - TinyOS Documentation Wiki</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META 
content="Resource Arbitration and Power Management,Storage,Writing Low-Power Applications,Concurrency" 
name=keywords><LINK href="/favicon.ico" rel="shortcut icon"><LINK 
title="TinyOS Documentation Wiki (English)" href="/opensearch_desc.php" 
type=application/opensearchdescription+xml rel=search>
<STYLE type=text/css media="screen, projection">@import url( /skins/common/shared.css?97 );
@import url( /skins/monobook/main.css?97 );
</STYLE>
<LINK media=print 
href="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/commonPrint.css" 
type=text/css rel=stylesheet><!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css?97";</style><![endif]--><!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css?97";</style><![endif]--><!--[if IE 6]>
<STYLE type=text/css>@import url( /skins/monobook/IE60Fixes.css?97 );
</STYLE>
<![endif]--><!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?97";</style><![endif]--><!--[if lt IE 7]>
<SCRIPT 
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/IEFixes.js" 
type=text/javascript></SCRIPT>

<META http-equiv=imagetoolbar content=no><![endif]-->
<SCRIPT type=text/javascript>/*<![CDATA[*/var skin = "monobook";var stylepath = "/skins";var wgArticlePath = "/index.php/$1";var wgScriptPath = "";var wgScript = "/index.php";var wgServer = "http://docs.tinyos.net";var wgCanonicalNamespace = "";var wgCanonicalSpecialPageName = false;var wgNamespaceNumber = 0;var wgPageName = "Resource_Arbitration_and_Power_Management";var wgTitle = "Resource Arbitration and Power Management";var wgAction = "view";var wgRestrictionEdit = [];var wgRestrictionMove = [];var wgArticleId = "14";var wgIsArticle = true;var wgUserName = null;var wgUserGroups = null;var wgUserLanguage = "en";var wgContentLanguage = "en";var wgBreakFrames = false;var wgCurRevisionId = "285";/*]]>*/</SCRIPT>

<SCRIPT 
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/wikibits.js" 
type=text/javascript><!-- wikibits js --></SCRIPT>

<SCRIPT 
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/index.php" 
type=text/javascript><!-- site js --></SCRIPT>

<STYLE type=text/css>@import url( /index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
@import url( /index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
@import url( /index.php?title=-&action=raw&gen=css&maxage=18000 );
</STYLE>
<!-- Head Scripts -->
<SCRIPT 
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/ajax.js" 
type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3268" name=GENERATOR></HEAD>
<BODY class="mediawiki ns-0 ltr page-Resource_Arbitration_and_Power_Management">
<DIV id=globalWrapper>
<DIV id=column-content>
<DIV id=content><A id=top name=top></A>
<H1 class=firstHeading>Resource Arbitration and Power Management</H1>
<DIV id=bodyContent>
<H3 id=siteSub>From TinyOS Documentation Wiki</H3>
<DIV id=contentSub></DIV>
<DIV id=jump-to-nav>Jump to: <A 
href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#column-one">navigation</A>, 
<A 
href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#searchInput">search</A></DIV><!-- start content -->
<TABLE class=toc id=toc summary=Contents>
  <TBODY>
  <TR>
    <TD>
      <DIV id=toctitle>
      <H2>Contents</H2></DIV>
      <UL>
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#Introduction"><SPAN 
        class=tocnumber>1</SPAN> <SPAN class=toctext>Introduction</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#Working_with_Shared_Resources"><SPAN 
        class=tocnumber>2</SPAN> <SPAN class=toctext>Working with Shared 
        Resources</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#Conclusion"><SPAN 
        class=tocnumber>3</SPAN> <SPAN class=toctext>Conclusion</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#Related_Documentation"><SPAN 
        class=tocnumber>4</SPAN> <SPAN class=toctext>Related 
        Documentation</SPAN></A> </LI></UL></TD></TR></TBODY></TABLE>
<SCRIPT type=text/javascript> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </SCRIPT>
<A name=Introduction></A>
<H1><SPAN class=mw-headline>Introduction</SPAN></H1>
<P>TinyOS distinguishes between three kinds of resource abstractions: 
<B>dedicated</B>, <B>virtualized</B>, and <B>shared</B>. </P>
<P>Two fundamental questions must be asked about each type of abstraction. </P>
<OL>
  <LI>How can a client gain access to the resource provided through this 
  abstraction? 
  <LI>How can the power state of that resource be controlled? </LI></OL>
<P>Components offer resource sharing mechanisms and power mangement capabilites 
according to the goals and level of abstraction required by their clients. </P>
<HR>

<P>An abstraction is dedicated if it represents a resource which a subsystem 
needs exclusive access to at all times. In this class of resources, no sharing 
policy is needed since only a single component ever requires use of the 
resource. Resource clients simply call commands from the interfaces provided by 
the resource just as they would with any other TinyOS component. Resources of 
this type provide either an <TT>AsyncStdControl</TT>, <TT>StdControl</TT>, or 
<TT>SplitControl</TT> interface for controlling their power states. The 
definition of each of these interfaces can be found in 
<TT>tinyos-2.x/tos/interfaces</TT>. </P><PRE>interface AsyncStdControl {
  async command error_t start();
  async command error_t stop();
}
</PRE><PRE>interface StdControl {
  command error_t start();
  command error_t stop();
}

interface SplitControl {
  async command error_t start();
  async command void startDone(error_t error);
  async command error_t stop();
  async command void stopDone(error_t error);
}
</PRE>
<P>Currently, the power states of all dedicated resources are controlled by one 
of these three interfaces. They are only allowed to enter one of two logical 
power states (on/off), regardless of the number of physical power states 
provided by the hardware on top of which their resource abstraction has been 
built. Which of these interfaces is provided by a particular resource depends on 
the timing requirements for physically powering it on or off. </P>
<HR>

<P>Virtual abstractions hide multiple clients from each other through software 
virtualization. Every client of a virtualized resource interacts with it as if 
it were a dedicated resource, with all virtualized instances being multiplexed 
on top of a single underlying resource. Because the virtualization is done in 
software, there is no upper bound on the number of clients using the 
abstraction, barring memory or efficiency constraints. The power states of a 
virtualized resource are handled automatically, and no interface is provided to 
the user for explicity controlling its power state. As they are built on top of 
shared resources, the reason their power states can be automatically controlled 
will become clearer after reading the following section. </P>
<HR>

<P>Dedicated abstractions are useful when a resource is always controlled by a 
single component. Virtualized abstractions are useful when clients are willing 
to pay a bit of overhead and sacrifice control in order to share a resource in a 
simple way. There are situations, however, when many clients need precise 
control of a resource. Clearly, they can't all have such control at the same 
time: some degree of multiplexing is needed. </P>
<P>A motivating example of a shared resource is a bus. The bus may have multiple 
peripherals on it, corresponding to different subsystems. For example, on the 
Telos platform the flash chip (storage) and the radio (network) share a bus. The 
storage and network stacks need exclusive access to the bus when using it, but 
they also need to share it with the other subsystem. In this case, 
virtualization is problematic, as the radio stack needs to be able to perform a 
series of operations in quick succession without having to reacquire the bus in 
each case. Having the bus be a shared resource allows the radio stack to send a 
series of operations to the radio atomically, without having to buffer them all 
up in memory beforehand (introducing memory pressure in the process). </P>
<P>In TinyOS, a resource <B>arbiter</B> is responsible for multiplexing between 
the different clients of a shared resource. It determines which client has 
access to the resource at which time. While a client holds a resource, it has 
complete and unfettered control. Arbiters assume that clients are cooperative, 
only acquiring the resource when needed and holding on to it no longer than 
necessary. Clients explicitly release resources: there is no way for an arbiter 
to forcibly reclaim it. </P>
<P>Shared resources are essentially built on top of dedicated resources, with 
access to them being controlled by an arbiter component. In this way, <B>power 
managers</B> can be used to automatically control the power state of these 
resources through their <TT>AsyncStdControl</TT>, <TT>StdControl</TT>, or 
<TT>SplitControl</TT> interfaces. They communicate with the arbiter (through the 
use of a <TT>ResourceDefaultOwner</TT> interface), monitoring whether the 
resource is being used by any of its clients and powering it on/off accordingly. 
The figure below shows how an arbiter component and a power manager can be wired 
together to provide arbitration and automatic power management for a shared 
resource. </P>
<CENTER><A class=image 
title="This is a picture of how an arbiter and power manager work together" 
href="http://docs.tinyos.net/index.php/Image:Arbiter_pm_graph.png"><IMG 
height=76 
alt="This is a picture of how an arbiter and power manager work together" 
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/225px-Arbiter_pm_graph.png" 
width=225 border=0></A><BR>Figure 1: Arbiters and Power Managers </CENTER>
<P>The arbiter component provides the <TT>Resource</TT>, <TT>ArbiterInfo</TT>, 
<TT>ResourceRequested</TT>, and <TT>ResourceDefaultOwner</TT> interfaces and 
uses the <TT>ResourceConfigure</TT> interface. The power manager doesn't provide 
any interfaces, but uses one of either the <TT>AsyncStdControl</TT>, 
<TT>StdControl</TT>, or <TT>SplitControl</TT> interfaces from the underlying 
resource, as well as the <TT>ResourceDefaultOwner</TT> interface provided by the 
arbiter. The figure below shows how these interface are then wired together with 
the implementation of a shared resource. Please refer to TEP 108 for more 
information on arbiters and TEP 115 for more information on Power Managers. </P>
<CENTER><A class=image 
title="This is a picture of how a shared resource works together with an arbiter and a power manager" 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -