{"id":316,"date":"2011-12-30T11:12:41","date_gmt":"2011-12-30T17:12:41","guid":{"rendered":"http:\/\/tommysprinkle.com\/txxos\/?p=316"},"modified":"2021-04-17T18:23:49","modified_gmt":"2021-04-17T23:23:49","slug":"dispatcher","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/txxos\/?p=316","title":{"rendered":"Dispatcher Overview"},"content":{"rendered":"<p>It is now time to start deveoloping a dispatcher to control the excution of Units Of Work or executable tasks.\u00a0 Each dispatchable unit of work will be defined by a control block we will call TCB.\u00a0 It will contain status\u00a0information about the unit of work and will be used to manage interrupts.\u00a0 When an interrupt occurs the dispatcher will save the current environment (registers and PSW) into the active TCB.\u00a0 A new unit of work can be dispatched by restoring the environment frrom a TCB.<\/p>\n<p>A second control block will be used along side the TCB to manage unit of work execution.\u00a0 It will function as a stack to manage levels of interirupts for a TCB.\u00a0 This block will be the RB.\u00a0 It will contain the PSW and Registers for a level of interruption under a TCB.<\/p>\n<p>The RB is pretty simple containing the following data:<\/p>\n<pre>RBNEXT   DS    A     - Next RB for this TCB\r\nRBWTCNT  DS    X     - Wait Count\r\nRBPSW    DS    D     - PSW Contents\r\nRBREGS   DS    16F   - Register Contents<\/pre>\n<p>The TCB is a little more complex and will contain the following data:<\/p>\n<pre>TCBNEXT  DS    A     - Next TCB in the dispatcher chain\r\n*\r\nTCBFLGS  DS    X     - Flags\r\nTCBFWAIT EQU   X'80' - TCB waiting on ECB\r\nTCBFNDSP EQU   X'40' - Do not dispatch\r\nTCBFETS  EQU   X'20' - Exceeded Time Slice\r\nTCBFLONG EQU   X'01' - Long Running Task\r\n*\r\nTCBFLGS2 DS    X     - Flags 2\r\n*\r\nTCBPRI   DS    X     - Execution Priority\r\nTCBKEY   DS    X     - Execution Key\r\nTCBECB   DS    A     - ECB to be Posted on Termination\r\nTCBERC   DS    F     - Error\/Return Code\r\nTCBPSW   DS    D     - PSW\r\nTCBREGS  DS    16F   - Registers<\/pre>\n<p>The TCB blocks will be maintained in a chain with each TCB pointing to the next ont he chain.\u00a0 The end of the chain will be indicated with a null pointer.\u00a0 The TCB on the chain is the Wait TCB.\u00a0 It does not represent any actual work but becomes the active TCB when the CPU is in a wait state waiting on work to be performed.\u00a0 The Wait TCB provides a place for the system status to be stored when an interrupt occurs and the CPU is waiting.<\/p>\n<p>The flags indicate the dispatchability of the TCB.\u00a0 If the TCB is waiting on an ECB the wait count field will be non-zero indicating the nubmer of events it is waiting on.\u00a0 The Exceded Time Slice flag indicates the TCB did not give up control of the CPU unitl it was forced as a result of the timer expiring.\u00a0 This flag indicates this TCB should not be dispatched again until no other work is waiting to be dispatched.<\/p>\n<p>[Next &#8211; <a title=\"TXXNUC \u2013 Nucleus Low Core\" href=\"http:\/\/tommysprinkle.com\/txxos\/?p=331\">Nucleus Low Core<\/a>]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is now time to start deveoloping a dispatcher to control the excution of Units Of Work or executable tasks.\u00a0 Each dispatchable unit of work will be defined by a control block we will call TCB.\u00a0 It will contain status\u00a0information &hellip; <a href=\"https:\/\/tommysprinkle.com\/txxos\/?p=316\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"template-page-builder-no-sidebar.php","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1CPQT-56","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316"}],"version-history":[{"count":10,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":486,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions\/486"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}