具有单独任务(ARM11)的POS上的多任务应用程序 [英] Multi task application on a POS with solo task (ARM11)

查看:193
本文介绍了具有单独任务(ARM11)的POS上的多任务应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在使用带ARM CPU的POS设备.

我的问题是此设备是单任务处理,因此我需要多个应用程序在此设备上同时运行.

换句话说,我需要模拟多线程,因为不存在对在给定平台上运行的并发线程的本地支持.

有人可以帮我解决这个问题吗?

谢谢;)

解决方案

我认为您正在部署程序的平台至少具有计时器功能?!

在这种情况下,您可以通过将每个任务作为一个单独的函数来虚拟化线程,并根据计时器事件在调度算法上运行它们(最简单的轮询).

但是,那么在抢占它们之前,您需要保存每个这样的虚拟线程的状态(函数的执行状态),鉴于您正在使用的平台的局限性,这将不是一件容易的事上.有时,这几乎是不可能的.

如果您实现了这一目标,将会带来复杂性,例如管理时间紧迫的任务,分配优先级等.

更不用说如果某个函数死锁或挂起,将会发生什么情况-您的程序将进入绝对不可恢复的状态,同时也会破坏其他虚拟线程的保存状态(因为您只有一个线程,并挂在某处).如果你问我,那不是一件愉快的事情.

我试图说服经理使用一个为我提供某种并发线程支持的平台.认真!


写道:​​

确切地说,所有操作系统都具有什么功能,称为多线程.



您是什么意思?


在所有操作系统中,我们可以同时运行不同的应用程序.
但是,我的POS系统上没有操作系统,因此,要同时运行不同的应用程序,我应该创建一种算法来管理同时运行的不同任务.


Hi all, I''m working on POS device with ARM CPU.

My problem is that this device is mono-task processing and I need multiple applications to run at the same time on this device.

In other words, I need to simulate multi-threading, because there''s no native support for concurrent threads to run on the given platform.

Can somebody help me to solve this?

Thanks ;)

解决方案

I presume that the platform that you''re deploying your programs at least has a timer facility?!

In which case, you can virtualise threads by having each of the task as a separate function and run them on a scheduling algorithm (round robin is the simplest) in response to the timer event.

But then you''ll need to save the state of each such virtual thread (execution state of the functions) before preempting them and that isn''t going to be an easy task, given the limitations of the platform you''re working on. Sometimes, this may be near impossible.

If you achieve this, there would come complexities like managing tasks that are time-critical, assigning priorities, etc.,

Not to mention what would happen if a function deadlocks or hangs - your program would get into a definitely irrecoverable state, damaging the saved state of other virtual threads as well (because all you have is one single thread, and it''s hung somewhere). Not a pleasant thing, if you ask me.

I''d try and convince my manager to use a platform that provides me with some sort of concurrent threading support instead. Seriously!


wrote:

Exactly what does all Operating Systeme, named multi-threading.



What do you mean by this?


In all operating system, we can run different application at same time.
But there''s no OS on my POS system, so for have diffrent application run at same time, I should creat an algorithm to manage diffrent task run at sane time.


这篇关于具有单独任务(ARM11)的POS上的多任务应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆