CN1609797A - 避规RTLinux双内核的方法 - Google Patents

避规RTLinux双内核的方法 Download PDF

Info

Publication number
CN1609797A
CN1609797A CN 200410084400 CN200410084400A CN1609797A CN 1609797 A CN1609797 A CN 1609797A CN 200410084400 CN200410084400 CN 200410084400 CN 200410084400 A CN200410084400 A CN 200410084400A CN 1609797 A CN1609797 A CN 1609797A
Authority
CN
China
Prior art keywords
rtl
rtlinux
real
time
kernel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200410084400
Other languages
English (en)
Other versions
CN1303525C (zh
Inventor
陈文智
蒋文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CNB2004100844001A priority Critical patent/CN1303525C/zh
Publication of CN1609797A publication Critical patent/CN1609797A/zh
Application granted granted Critical
Publication of CN1303525C publication Critical patent/CN1303525C/zh
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)
  • Hardware Redundancy (AREA)

Abstract

本发明公开了一种避规RTLinux双内核的方法。在原有的RTLinux内核的基础上进行修改,在基本不影响实时的前提下更改原来的双内核结构,将提供实时的部分融入原来的相应的Linux内核中并将非实时任务和实时任务统一调度,形成单内核结构,启动即可提供实时服务。

Description

避规RTLinux双内核的方法
技术领域
本发明涉及操作系统的设计与实现技术,特别地,涉及一种避规RTLinux双内核的方法。
技术背景
实时操作系统RTOS(Real-Time Operating System)集中了实时系统和操作系统的优点。它是嵌入式系统的系统软件,一个优秀的RTOS是嵌入式系统成功的关键。FSMLabs公司的RTLinux有着强实时性,开放源码以及系统的稳定性和Linux兼容性的优点。但是,现有RTLinux在载入实时模块的时候,需要较大的内存,而且使用不方便。
发明内容
本发明的目的在于针对现有技术的不足,提供一种避规RTLinux双内核的方法。
本发明的目的是通过以下技术方案来实现的,一种避规RTLinux双内核的方法,其特征在于,包括以下步骤:
(1)修改RTLinux各实时模块的的入口函数;
(2)将Linux的schedule()改名为get_rtl_process(),并删除其中的switch_two();
(3)在Rtlinux中添加schedule(),其直接调用RTLinux的调度函数rtl_schedule();
(4)修改Linux的copy_thread(),并在末尾添加init_rtl_process();
(5)在RTLinux的rtl_schedule()中添加switch_status();
(6)修改Linux和RTLinux根目录下的Makefile文件,将实时模块和Linux内核静态地编译在一起,形成新的内核。
进一步地,步骤(1)中,修改RTLinux各实时模块的的入口函数为:将RTLinux的rtl_core.o、rtl_time.o和rtl_sched.o的入口函数init_module()分别改名为init_rtl_core()、init_rtl_time()和init_rtl_sched()。
本发明具有以下技术效果:(1)RTLinux的硬实时性及功能,可以运行所有相关RTLinux上的所有程序;保留原有Linux功能,可以运行所有相关Linux上的所有程序。(2)启动即可提供实时服务。(3)实现了只运行实时程序,不运行Linux任何进程以保证程序的实时性。
附图说明
图1是现有RTLinux的系统逻辑结构流程图;
图2是本发明的系统逻辑结构流程图。
具体实施方式
图1示出了现有RTLinux的系统逻辑结构图;图2示出了本发明的系统逻辑结构图。本发明的避规RTLinux双内核的方法分为以下几个步骤:
一.修改RTLinux各实时模块的的入口函数。
将RTLinux的rtl_core.o、rtl_time.o和rtl_sched.o的入口函数init_module()分别改名为init_rtl_core()、init_rtl_time()和init_rtl_sched()。
改动原来Linux进程控制块结构,将RTLinux的实时线程控制块(structrtl_thread_struct)和Linux进程控制块结构(struct task_struct)结合在一起形成新的Linux进程控制块结构(struct rtl_process_struct):
struct rtl_process_struct
{
    struct task_struct;
    struct rtl_thread_struct;
};
二.将Linux的调度函数schedule()改名为get_rtl_process(),并删除其中的switch_two():
原来的调度函数schedule()中对进程的选择由函数get_rtl_process()实现:
struct rtl_process_struct*get_rtl_process(int cpu_id)
{
  。。。。。。(和原来相同省略)
  rtl_process_userspace_switch(prev,next,this_cpu);
  _schedule_tail(prev);
same_process:
  reacquire_kernel_lock(next);
  return(struct rtl_process_struct*)next;
}
三.在Rtlinux中添加schedule(),其直接调用RTLinux的rtl_schedule()调度函数。
     int rtl_schedule(void)

     {

       clear_bit(RTL_PROCESS_RESCHEDULE,&LOCAL_SCHED->sched_flags);
        return_rtl_schedule();

      }

     int_rtl_schedule(void)

       {

         。。。。。。(和原来相同省略)

       if(new_task)
 
       {

          rtl_make_rt_system_active();

            if(test_bit(VX_SCHED_RR,&LOCAL_SCHED->sched_flags))

             s->rtl_tasks=new_task->next;

         }

        else

        {

           rtl_make_rt_system_idle();
  
     if(test_and_set_bit(RTL_PROCESS_RESCHEDULE,&sched->sched_flags))

           {
        <!-- SIPO <DP n="3"> -->
        <dp n="d3"/>
                new_task=&(get_rtl_process(cpu_id)->thread_t);

                   sched->rtl_process=new_task;

            }

          else

          {

                new_task=sched->rtl_process;

            }

      }

      。。。。。。(和原来相同省略)

   }
四.修改Linux的copy_thread(),并在末尾添加init_ rtl_process()。
五.在RTLinux的rtl_schedule()中添加switch_status()。
六.然后修改Linux和RTLinux根目录下的Makefile文件,将实时模块和Linux内核静态地编译在一起,形成新的内核。
将非实时的linux进程和实时线程放在一起竞争所有的切换都由rtl_switch_to完成。在区分不同的调度情况的前提下形成有实时任务的时候选择实时任务,没有实时任务的时候选择非实时进程的逻辑。
本发明保留原RTLinux的硬实时性及功能,可以运行所有相关RTLinux上的所有程序;保留原有Linux功能,可以运行所有相关Linux上的所有程序:系统是在RTLinux的基础上进行改进的,只是修改了RTLinux的结构(包括调度和中断部分)不影响新系统的实时性;还可以和RTLinux一样运行所有相关Linux上的所有程序。
本发明启动即可提供实时服务,本发明在原有的RTLinux(3.0版)内核的基础上进行修改,在基本不影响实时的前提下更改原来的dual-kernel结构,将提供实时的部分融入原来的相应的Linux内核中并将非实时任务和实时任务统一调度,形成单内核结构,启动即可运行实时程序。
本发明实现了只运行实时程序,不运行Linux任何进程以保证程序的实时性:为了保证某些程序的对实时性的要求,可以取消非实时任务的打扰,故增加实时idle线程使得系统不调度Linux,因此Linux的进程以及任何驱动都无法执行,这样就最大程度保证了实时性。

Claims (2)

1、一种避规RTLinux双内核的方法,其特征在于,包括以下步骤:
(1)修改RTLinux各实时模块的的入口函数。
(2)将Linux的schedule()改名为get_rtl_process(),并删除其中的switch_two()。
(3)在Rtlinux中添加schedule(),其直接调用RTLinux的调度函数rtl_schedule()。
(4)修改Linux的copy_thread(),并在末尾添加init_rtl_process()。
(5)在RTLinux的rtl_schedule()中添加switch_status()。
(6)修改Linux和RTLinux根目录下的Makefile文件,将实时模块和Linux内核静态地编译在一起,形成新的内核。
2.根据权利要求1所述的避规RTLinux双内核的方法,其特征在于,所述步骤(1)中,将RTLinux的rtl_core.o、rtl_time.o和rtl_sched.o的入口函数init_module()分别改名为init_rtl_core()、init_rtl_time()和ini_trtl_sched()。
CNB2004100844001A 2004-11-22 2004-11-22 避规RTLinux双内核的方法 Expired - Fee Related CN1303525C (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100844001A CN1303525C (zh) 2004-11-22 2004-11-22 避规RTLinux双内核的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100844001A CN1303525C (zh) 2004-11-22 2004-11-22 避规RTLinux双内核的方法

Publications (2)

Publication Number Publication Date
CN1609797A true CN1609797A (zh) 2005-04-27
CN1303525C CN1303525C (zh) 2007-03-07

Family

ID=34765880

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100844001A Expired - Fee Related CN1303525C (zh) 2004-11-22 2004-11-22 避规RTLinux双内核的方法

Country Status (1)

Country Link
CN (1) CN1303525C (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101707653A (zh) * 2009-11-25 2010-05-12 北京天碁科技有限公司 一种单处理器智能移动终端及其实现方法
CN102141915A (zh) * 2010-12-29 2011-08-03 中国船舶重工集团公司第七研究院 一种基于RTLinux的设备实时控制方法
CN104866373A (zh) * 2015-05-20 2015-08-26 南京国电南自电网自动化有限公司 基于跨平台技术的实时操作系统仿真方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191445B2 (en) * 2001-08-31 2007-03-13 Texas Instruments Incorporated Method using embedded real-time analysis components with corresponding real-time operating system software objects

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101707653A (zh) * 2009-11-25 2010-05-12 北京天碁科技有限公司 一种单处理器智能移动终端及其实现方法
CN102141915A (zh) * 2010-12-29 2011-08-03 中国船舶重工集团公司第七研究院 一种基于RTLinux的设备实时控制方法
CN102141915B (zh) * 2010-12-29 2014-05-14 中国船舶重工集团公司第七研究院 一种基于RTLinux的设备实时控制方法
CN104866373A (zh) * 2015-05-20 2015-08-26 南京国电南自电网自动化有限公司 基于跨平台技术的实时操作系统仿真方法
CN104866373B (zh) * 2015-05-20 2019-01-18 南京国电南自电网自动化有限公司 基于跨平台技术的实时操作系统仿真方法

Also Published As

Publication number Publication date
CN1303525C (zh) 2007-03-07

Similar Documents

Publication Publication Date Title
CN1230744C (zh) 一种嵌入式系统软件补丁的实现和控制方法
EP0905618B1 (en) Microcontroller, data processing system and task switching control method
CN1081006A (zh) 计算机系统中软件模块的运行期动态联编系统
CN1208721C (zh) 基于PowerPC处理器结构的分级任务切换方法
EP1880289B1 (en) Transparent support for operating system services
US8321874B2 (en) Intelligent context migration for user mode scheduling
CN1794185A (zh) 一种多线程处理中的资源调用方法
CN1818875A (zh) 嵌入式操作系统分组硬实时任务调度的实现方法
CN100346303C (zh) Java操作系统中类装载的实现方法
JPH06250853A (ja) プロセス・スケジューリングの管理方法およびシステム
CN1580994A (zh) 用于工业自动化的cil代码程序的在线修改
CN1609797A (zh) 避规RTLinux双内核的方法
US7584452B1 (en) System and method for controlling the visibility and use of data in a programming environment
US5974346A (en) Method for controlling technical processes
CN1801086A (zh) 应用于Java操作系统中设备支持的实现方法
CN112130988B (zh) 一种基于优先级分区的任务加速优化方法及装置
US7434222B2 (en) Task context switching RTOS
CN1304944C (zh) 预先读取脱序执行指令的方法及处理器
CN1234066C (zh) 基于操作队列复用的指令流水线系统和方法
CN1949173A (zh) 一种软件的安装方法及其装置
Nakano et al. Performance evaluation of STRON: A hardware implementation of a real-time OS
CN110532030B (zh) 一种cpu中优化寄存器访问的方法
CN112286697A (zh) 基于无操作系统单片机平台的互斥资源访问方法
CN113467911A (zh) RISCV架构多核CPU memory consistency仿真验证方法
CN118069152B (zh) 一种基于申威处理器的增强系统实时性方法

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070307

Termination date: 20101122