TWI768478B - Electronic device and method and for adaptively arranging external hardware resources - Google Patents

Electronic device and method and for adaptively arranging external hardware resources Download PDF

Info

Publication number
TWI768478B
TWI768478B TW109133249A TW109133249A TWI768478B TW I768478 B TWI768478 B TW I768478B TW 109133249 A TW109133249 A TW 109133249A TW 109133249 A TW109133249 A TW 109133249A TW I768478 B TWI768478 B TW I768478B
Authority
TW
Taiwan
Prior art keywords
external
operating system
hardware
response
determining
Prior art date
Application number
TW109133249A
Other languages
Chinese (zh)
Other versions
TW202213119A (en
Inventor
陳冠儒
Original Assignee
宏碁股份有限公司
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 宏碁股份有限公司 filed Critical 宏碁股份有限公司
Priority to TW109133249A priority Critical patent/TWI768478B/en
Publication of TW202213119A publication Critical patent/TW202213119A/en
Application granted granted Critical
Publication of TWI768478B publication Critical patent/TWI768478B/en

Links

Images

Abstract

The disclosure provides an electronic device and a method and for adaptively arranging external hardware resources. The electronic device is built with a virtual environment, and a guest operating system is executed in the virtual environment. The method includes: obtaining a usage rate of a specific hardware device in the electronic device in response to receiving a virtual device command from the guest operating system; in response to determining that the usage rate of the specific hardware device is higher than a usage rate threshold, obtaining a foreground process, background process, and operating system services of the electronic device, and determining an external resource demand accordingly; arranging a hardware device of an external device based on the external resource demand, and using the hardware device of the external device and the specific hardware device to collaboratively execute the foreground process, the background process and the operating system service.

Description

適應性調用外部硬體資源的方法A method for adaptively calling external hardware resources

本發明是有關於一種調用硬體資源的技術,且特別是有關於一種適應性調用外部硬體資源的方法及電子裝置。 The present invention relates to a technology for invoking hardware resources, and more particularly, to a method and electronic device for adaptively invoking external hardware resources.

經量測,使用Chrome作業系統(OS)的電子裝置(例如Chromebook)在使用圖像處理單元(GPU)時的效能數據遠不及使用WindowsTM 10的電子裝置。 It has been measured that the performance data of electronic devices using the Chrome Operating System (OS), such as Chromebooks, when using a graphics processing unit (GPU) is far inferior to that of electronic devices using Windows 10.

在現有技術中,雖存在有調用外部裝置的硬體資源來協助本地裝置運行程式、軟體以改善運行效能的技術,但針對虛擬環境而言,目前並未有相關的技術存在。 In the prior art, although there is a technology of invoking the hardware resources of an external device to assist the local device to run programs and software to improve the running performance, there is currently no relevant technology for a virtual environment.

有鑑於此,本發明提供一種適應性調用外部硬體資源的方法及電子裝置,其可用於解決上述技術問題。 In view of this, the present invention provides a method and electronic device for adaptively calling external hardware resources, which can be used to solve the above technical problems.

本發明提供一種適應性調用外部硬體資源的方法,適於 一電子裝置,其中電子裝置經建置有一虛擬環境,且虛擬環境中運行有一客戶作業系統,包括:反應於接收到來自客戶作業系統的一虛擬裝置命令,取得電子裝置中一特定硬體裝置的一使用率;反應於判定特定硬體裝置的使用率高於一第一使用率門限值,取得電子裝置的一前景程序、一背景程序及至少一作業系統服務,並依據前景程序、背景程序及至少一作業系統服務決定一外部資源需求量;基於外部資源需求量調用至少一外部裝置的硬體裝置,並以至少一外部裝置的硬體裝置及特定硬體裝置協同運行前景程序、背景程序及至少一作業系統服務。 The present invention provides a method for adaptively calling external hardware resources, which is suitable for An electronic device, wherein a virtual environment is built in the electronic device, and a guest operating system is running in the virtual environment, comprising: in response to receiving a virtual device command from the guest operating system, obtaining the information of a specific hardware device in the electronic device a usage rate; in response to determining that the usage rate of a specific hardware device is higher than a first usage rate threshold, obtain a foreground program, a background program and at least one operating system service of the electronic device, and obtain a foreground program, a background program and at least one operating system service according to the foreground program, background program and At least one operating system service determines an external resource requirement; invokes a hardware device of at least one external device based on the external resource requirement, and uses the hardware device of the at least one external device and a specific hardware device to cooperatively run foreground programs, background programs and At least one operating system service.

本發明提供一種電子裝置,其中電子裝置經建置有一虛擬環境,且虛擬環境中運行有一客戶作業系統。電子裝置包括儲存電路及處理器。儲存電路儲存有多個模組。處理器耦接於儲存電路,並存取所述多個模組以執行下列步驟:反應於接收到來自客戶作業系統的一虛擬裝置命令,取得電子裝置中一特定硬體裝置的一使用率;反應於判定特定硬體裝置的使用率高於一第一使用率門限值,取得電子裝置的一前景程序、一背景程序及至少一作業系統服務,並依據前景程序、背景程序及至少一作業系統服務決定一外部資源需求量;基於外部資源需求量調用至少一外部裝置的硬體裝置,並以至少一外部裝置的硬體裝置及特定硬體裝置協同運行前景程序、背景程序及至少一作業系統服務。 The invention provides an electronic device, wherein a virtual environment is built in the electronic device, and a client operating system runs in the virtual environment. The electronic device includes a storage circuit and a processor. The storage circuit stores a plurality of modules. The processor is coupled to the storage circuit and accesses the plurality of modules to perform the following steps: obtaining a usage rate of a specific hardware device in the electronic device in response to receiving a virtual device command from the client operating system; In response to determining that the usage rate of the specific hardware device is higher than a first usage rate threshold value, obtain a foreground program, a background program and at least one operating system service of the electronic device, and according to the foreground program, the background program and the at least one operating system The service determines an external resource requirement; invokes the hardware device of at least one external device based on the external resource requirement, and uses the hardware device of the at least one external device and a specific hardware device to cooperatively run a foreground program, a background program and at least one operating system Serve.

100,200:電子裝置 100,200: Electronic devices

102,202:虛擬環境 102, 202: Virtual Environments

104,206:客戶作業系統 104,206: Customer Operating System

201:CPU 201:CPU

204:資源安排函式庫 204: Resource scheduling library

204a:資源安排推理API 204a: Resource Scheduling Reasoning API

204b:外部資源安排API 204b: External Resource Scheduling API

299:外部裝置 299: External Devices

S310~S330,S410~S480:步驟 S310~S330, S410~S480: Steps

圖1是依據本發明之一實施例繪示的電子裝置實體環境與虛擬環境示意圖。 FIG. 1 is a schematic diagram of a physical environment and a virtual environment of an electronic device according to an embodiment of the present invention.

圖2是依據圖1繪示的電子裝置實體環境與虛擬環境以及外部裝置的示意圖。 FIG. 2 is a schematic diagram of the physical environment, the virtual environment and the external device of the electronic device shown in FIG. 1 .

圖3是依據本發明之一實施例繪示的適應性調用外部硬體資源的方法流程圖。 FIG. 3 is a flowchart of a method for adaptively calling external hardware resources according to an embodiment of the present invention.

圖4是依據本發明之一實施例繪示的調用外部裝置的硬體裝置機制示意圖。 FIG. 4 is a schematic diagram of a hardware device mechanism for invoking an external device according to an embodiment of the present invention.

請參照圖1,其是依據本發明之一實施例繪示的電子裝置實體環境與虛擬環境示意圖。在不同的實施例中,電子裝置100例如是各式電腦裝置及智慧型裝置,但可不限於此。在圖1中,電子裝置100可包括各式處理器(例如中央處理單元(CPU)、GPU)、各式儲存電路(例如系統隨機存取記憶體(RAM)、圖像RAM)、螢幕、螢幕控制器等硬體裝置,但可不限於此。 Please refer to FIG. 1 , which is a schematic diagram of a physical environment and a virtual environment of an electronic device according to an embodiment of the present invention. In different embodiments, the electronic device 100 is, for example, various computer devices and smart devices, but not limited thereto. In FIG. 1 , the electronic device 100 may include various processors (eg, central processing unit (CPU), GPU), various storage circuits (eg, system random access memory (RAM), image RAM), screens, screens A hardware device such as a controller, but not limited to this.

另外,電子裝置100上可經建置有虛擬環境102,而其中可運行有客戶作業系統(guest OS)104。在不同的實施例中,虛擬環境102例如可採用虛擬機器(virtual machine,VM)、容器(container)、Docker映像檔、Wine等方式實現,而作業系統104例如是Chrome作業系統、WindowsTM,或其他類似者。 In addition, a virtual environment 102 may be built on the electronic device 100, and a guest operating system (guest OS) 104 may be executed therein. In different embodiments, the virtual environment 102 can be implemented by, for example, a virtual machine (VM), a container (container), a Docker image, Wine, etc., and the operating system 104 is, for example, Chrome OS, Windows , or other similar ones.

如圖1所示,在虛擬環境102中可運行有圖像函式庫(graphic library,GL)渲染器(renderer),而在作業系統104中可運行有VirGL、Vulkan、Virtio-GPU及應用程式。此外,電子裝置100本身可運行有主作業系統(host OS),而此主作業系統可運行有OpenGL、Vulkan及系統呼叫介面(system call interface,SCI)等程式,但可不限於此。 As shown in FIG. 1 , a graphics library (GL) renderer may run in the virtual environment 102 , and VirGL, Vulkan, Virtio-GPU and applications may run in the operating system 104 . . In addition, the electronic device 100 itself may run a host OS, and the host OS may run programs such as OpenGL, Vulkan, and system call interface (SCI), but not limited thereto.

圖1所示的各種軟體/程序可參照相關現有技術中的說明,故其細節於此不另贅述。 For the various software/programs shown in FIG. 1 , reference may be made to the descriptions in the related art, so the details thereof will not be repeated here.

請參照圖2,其是依據圖1繪示的電子裝置實體環境與虛擬環境以及外部裝置的示意圖。在圖2中,電子裝置200可以各種有線/無線方式連接於一或多個外部裝置299(其例如是各式電腦裝置及/或智慧型裝置),而電子裝置200可基於本發明提出的方法適應性地調用這些外部裝置299中的一或多者所提供的可用資源,相關細節將在之後詳述。 Please refer to FIG. 2 , which is a schematic diagram of the physical environment, the virtual environment and the external device of the electronic device shown in FIG. 1 . In FIG. 2, the electronic device 200 can be connected to one or more external devices 299 (such as various computer devices and/or smart devices) in various wired/wireless ways, and the electronic device 200 can be based on the method proposed in the present invention Available resources provided by one or more of these external devices 299 are adaptively invoked, details of which will be described later.

如圖2所示,電子裝置200的硬體架構及實施方式大致相似於圖1中的電子裝置100,惟電子裝置200的虛擬環境202中另設置有資源安排函式庫204,而其可包括資源安排推理應用程式介面(API)204a及外部資源安排API 204b。 As shown in FIG. 2 , the hardware structure and implementation of the electronic device 200 are substantially similar to the electronic device 100 in FIG. 1 , but the virtual environment 202 of the electronic device 200 is further provided with a resource arrangement library 204 , which may include Resource scheduling reasoning application programming interface (API) 204a and external resource scheduling API 204b.

在本發明的一實施例中,電子裝置200中的CPU 201可用於執行資源安排推理API 204a及外部資源安排API 204b,以執行本發明提出的適應性調用外部硬體資源的方法,以下將作進一步說明。 In an embodiment of the present invention, the CPU 201 in the electronic device 200 can be used to execute the resource arrangement reasoning API 204a and the external resource arrangement API 204b, so as to execute the method for adaptively calling external hardware resources proposed by the present invention. Further explanation.

請參照圖3,其是依據本發明之一實施例繪示的適應性調用外部硬體資源的方法流程圖。本實施例的方法可由圖2的電子裝置200執行,以下即搭配圖2所示的元件說明圖3各步驟的細節。 Please refer to FIG. 3 , which is a flowchart of a method for adaptively calling external hardware resources according to an embodiment of the present invention. The method of this embodiment can be performed by the electronic device 200 in FIG. 2 , and the details of each step in FIG. 3 will be described below in conjunction with the elements shown in FIG. 2 .

首先,在步驟S310中,反應於接收到來自客戶作業系統206的虛擬裝置命令,CPU 201可執行資源安排推理API 204a以取得電子裝置200中特定硬體裝置的使用率。在一實施例中,上述虛擬裝置命令例如是Virtio裝置命令(Virtio device command),但可不限於此。另外,在不同的實施例中,上述特定硬體裝置例如是電子裝置200的CPU 201、GPU、系統RAM及/或圖像RAM,或其他電子裝置200中的硬體裝置。 First, in step S310 , in response to receiving the virtual device command from the guest operating system 206 , the CPU 201 executes the resource allocation reasoning API 204 a to obtain the usage rate of a specific hardware device in the electronic device 200 . In one embodiment, the above-mentioned virtual device command is, for example, a Virtio device command, but it is not limited thereto. In addition, in different embodiments, the above-mentioned specific hardware devices are, for example, the CPU 201 , the GPU, the system RAM and/or the image RAM of the electronic device 200 , or other hardware devices in the electronic device 200 .

為便於說明,以下將以CPU 201作為所述特定硬體裝置的實例,但其並非用以限定本發明可能的實施方式。在此情況下,CPU 201在步驟S310中可取得自身的使用率,並可接著判斷所取得的使用率是否高於第一負載門限值。 For the convenience of description, the CPU 201 will be used as an example of the specific hardware device below, but it is not intended to limit possible implementations of the present invention. In this case, the CPU 201 can obtain its own usage rate in step S310, and can then determine whether the obtained usage rate is higher than the first load threshold value.

在不同的實施例中,所述第一負載門限值可理解為判斷特定硬體裝置(例如CPU 201)是否處於過載狀態的依據,而設計者可依需求而設定第一負載門限值的數值(例如95%),但可不限於此。 In different embodiments, the first load threshold value can be understood as a basis for judging whether a specific hardware device (such as the CPU 201 ) is in an overload state, and the designer can set the value of the first load threshold value ( For example, 95%), but not limited to this.

在一實施例中,反應於判定特定硬體裝置的使用率未高於第一使用率門限值,則CPU 201可執行資源安排推理API 204a以僅以特定硬體裝置運行電子裝置200的前景程序、背景程序及 作業系統服務。 In one embodiment, in response to determining that the usage rate of the specific hardware device is not higher than the first usage rate threshold, the CPU 201 can execute the resource allocation reasoning API 204a to run the foreground program of the electronic device 200 only with the specific hardware device , background programs and Operating system services.

另一方面,在步驟S320中,反應於判定特定硬體裝置的使用率高於第一使用率門限值,CPU 201可執行資源安排推理API 204a以取得電子裝置200的前景程序、背景程序及作業系統服務(OS service),並依據前景程序、背景程序及作業系統服務決定外部資源需求量。在不同的實施例中,上述前景/背景程序例如是電子裝置200上運作中的各式前景/背景應用程式/軟體,而所述作業系統服務例如是記錄於工作管理員中的各式軟體服務,但可不限於此。 On the other hand, in step S320 , in response to determining that the usage rate of the specific hardware device is higher than the first usage rate threshold, the CPU 201 executes the resource allocation reasoning API 204a to obtain the foreground program, background program and operation of the electronic device 200 System service (OS service), and determines the external resource demand according to foreground programs, background programs and operating system services. In different embodiments, the aforementioned foreground/background programs are, for example, various foreground/background applications/software running on the electronic device 200, and the operating system services are, for example, various software services recorded in the job administrator , but not limited to this.

在一實施例中,CPU 201例如可執行資源安排推理API 204a以將前景程序、背景程序及作業系統服務輸入經訓練的人工智慧模型,其中人工智慧模型可因應於前景程序、背景程序及作業系統服務而輸出一特定資源需求量。 In one embodiment, the CPU 201, for example, can execute the resource scheduling reasoning API 204a to input foreground programs, background programs, and operating system services into a trained artificial intelligence model, wherein the artificial intelligence model can correspond to foreground programs, background programs, and operating systems service and output a specific resource demand.

在一實施例中,上述人工智慧模型例如是一長短期記憶(long short term memory,LSTM)模型,而在其相關的預訓練過程中,設計者例如可先將某個裝置運作某些前景程序、背景程序及作業系統服務時的硬體裝置使用率(例如CPU使用率)、裝置規格、容量、作業系統顯示的裝置資訊等內容轉換為兩份文字檔,以作為上述人工智慧模型的訓練資料集。在訓練所述人工智慧模型的過程中,可建立每一組前景程序、背景程序及作業系統服務與所調用到的硬體裝置(包括CPU/GPU/RAM)的資源(例如頁面檔案(page file)、Swap檔案、Swap分割等)的關聯性。藉此, 在完成所述人工智慧模型的訓練之後,當所述人工智慧模型接收到以文字檔表示的某一組前景程序、背景程序及作業系統服務時,所述人工智慧模型即可相應地提供需多少硬體資源(即,所述特定資源需求量)才能讓硬體裝置以較低的使用率(例如50%)運行此組前景程序、背景程序及作業系統服務。 In one embodiment, the above-mentioned artificial intelligence model is, for example, a long short term memory (LSTM) model, and in the related pre-training process, the designer may, for example, run a certain device with some foreground programs first. , the hardware device usage rate (such as CPU usage rate), device specifications, capacity, and device information displayed by the operating system during background programs and operating system services are converted into two text files, which are used as the training data for the above artificial intelligence model set. In the process of training the artificial intelligence model, each set of foreground programs, background programs and operating system services and the resources (such as page files) of the called hardware devices (including CPU/GPU/RAM) can be created ), Swap archives, Swap splits, etc.). By this, After completing the training of the artificial intelligence model, when the artificial intelligence model receives a certain set of foreground programs, background programs and operating system services represented by text files, the artificial intelligence model can accordingly provide the required amount of The hardware resources (ie, the specific resource requirements) can allow the hardware device to run the set of foreground programs, background programs, and operating system services at a low utilization rate (eg, 50%).

在取得所述特定資源需求量之後,CPU 201可執行資源安排推理API 204a以基於特定資源需求量與特定硬體裝置(例如CPU 201)的可用資源量決定外部資源需求量。例如,CPU 201可將特定資源需求量與特定硬體裝置的可用資源量之間的差值作為上述外部資源需求量,但可不限於此。 After obtaining the specific resource requirements, the CPU 201 can execute the resource scheduling inference API 204a to determine the external resource requirements based on the specific resource requirements and the available resources of a specific hardware device (eg, the CPU 201 ). For example, the CPU 201 may use the difference between the specific resource demand and the available resource of the specific hardware device as the above-mentioned external resource demand, but it is not limited thereto.

接著,在步驟S330中,CPU 201可執行外部資源安排API 204b基於外部資源需求量調用外部裝置的硬體裝置,並以外部裝置的硬體裝置及特定硬體裝置協同運行前景程序、背景程序及作業系統服務。為便於說明,以下另輔以圖4說明步驟S330的細節。 Next, in step S330, the CPU 201 can execute the external resource arrangement API 204b to call the hardware device of the external device based on the external resource demand, and use the hardware device of the external device and the specific hardware device to cooperatively run the foreground program, the background program and the Operating system services. For the convenience of description, the details of step S330 are described below with reference to FIG. 4 .

請參照圖4,其是依據本發明之一實施例繪示的調用外部裝置的硬體裝置機制示意圖。圖4的各個步驟可由CPU 201藉由執行外部資源安排API 204b以實現。概略而言,假設外部裝置299皆具有虛擬環境,則對於外部裝置299中的第i個外部裝置而言,CPU 201可判斷外部裝置299中的第1個外部裝置(下稱第一外部裝置)至所述第i個外部裝置所能提供的全部可用資源是否可滿足所述外部資源需求量。若是,則CPU 201可相應地調用所述第 1個至第i個外部裝置的硬體裝置來協助電子裝置200運行前景程序、背景程序及作業系統服務,反之則可對外部裝置299中的第i+1個外部裝置進行上述判斷,直至所述外部資源需求量被滿足為止,但可不限於此。 Please refer to FIG. 4 , which is a schematic diagram of a hardware device mechanism for calling an external device according to an embodiment of the present invention. The various steps of FIG. 4 may be implemented by the CPU 201 by executing the external resource scheduling API 204b. Roughly speaking, assuming that all the external devices 299 have virtual environments, for the i-th external device in the external devices 299, the CPU 201 can determine the first external device in the external devices 299 (hereinafter referred to as the first external device) Whether all available resources that can be provided by the i-th external device can meet the external resource demand. If so, the CPU 201 can accordingly call the The hardware devices from 1 to the i-th external device are used to assist the electronic device 200 to run foreground programs, background programs and operating system services. until the external resource demand is satisfied, but not limited to this.

具體而言,在步驟S410中,CPU 201可判斷第一外部裝置是否具有作業系統。若是,則CPU 201可執行步驟S420,反之則可執行步驟S460以忽略第一外部裝置。並且,在步驟S460之後,CPU 201可接續執行步驟S480,而其細節將在之後詳述。 Specifically, in step S410, the CPU 201 may determine whether the first external device has an operating system. If so, the CPU 201 can execute step S420, otherwise, execute step S460 to ignore the first external device. And, after step S460, the CPU 201 may continue to execute step S480, the details of which will be described later.

在步驟S420中,CPU 201可判斷第一外部裝置是否具有虛擬環境。若否,則CPU 201可執行步驟S470以控制第一外部裝置建立虛擬環境,並接著執行步驟S430。另一方面,若CPU 201在步驟S420中判定第一外部裝置具有虛擬環境,則CPU 201可接著執行步驟S430,以取得第一外部裝置中對應於特定硬體裝置的第一硬體裝置的第一可用硬體資源。承上例,在特定硬體裝置經假設為電子裝置200的CPU 201的情況下,CPU 201例如可相應地取得第一外部裝置中CPU的可用硬體資源作為上述第一可用硬體資源,但可不限於此。 In step S420, the CPU 201 may determine whether the first external device has a virtual environment. If not, the CPU 201 may execute step S470 to control the first external device to establish a virtual environment, and then execute step S430. On the other hand, if the CPU 201 determines in step S420 that the first external device has a virtual environment, the CPU 201 may then execute step S430 to obtain the first hardware device of the first external device corresponding to the specific hardware device. - Available hardware resources. Following the above example, in the case where the specific hardware device is assumed to be the CPU 201 of the electronic device 200, the CPU 201 can accordingly obtain the available hardware resources of the CPU in the first external device as the above-mentioned first available hardware resources, but But not limited to this.

之後,在步驟S440中,CPU 201可判斷第一可用硬體資源是否滿足外部資源需求量。若是,則CPU 201可執行步驟S450以調用第一外部裝置的第一硬體裝置(例如CPU),並以第一硬體裝置與特定硬體裝置協同運行前景程序、背景程序及作業系統服務。在一實施例中,CPU 201例如可將第一硬體裝置的相關資訊 回報至圖2中的客戶作業系統206,以讓客戶作業系統206可同時使用電子裝置200的CPU 201及第一外部裝置的第一硬體裝置(例如CPU)來運行步驟S320中所取得的前景程序、背景程序及作業系統服務,但可不限於此。 Afterwards, in step S440, the CPU 201 may determine whether the first available hardware resource meets the external resource requirement. If so, the CPU 201 can execute step S450 to call the first hardware device (eg CPU) of the first external device, and use the first hardware device to cooperate with the specific hardware device to run the foreground program, background program and operating system service. In one embodiment, the CPU 201 may, for example, store relevant information of the first hardware device Report back to the client operating system 206 in FIG. 2 , so that the client operating system 206 can use the CPU 201 of the electronic device 200 and the first hardware device (eg CPU) of the first external device at the same time to run the prospect obtained in step S320 Programs, background programs, and operating system services, but not limited thereto.

另一方面,若CPU 201在步驟S440中判斷第一可用硬體資源未滿足外部資源需求量,則CPU 201可接續執行步驟S480,以調用其他外部裝置。 On the other hand, if the CPU 201 determines in step S440 that the first available hardware resource does not meet the external resource requirement, the CPU 201 may continue to perform step S480 to call other external devices.

概略而言,CPU 201可接著對外部裝置299中的第2個外部裝置(下稱第二外部裝置)進行類似於步驟S410~S480的內容,惟在對第二外部裝置執行步驟S440的細節略有不同。 Roughly speaking, the CPU 201 can then perform the content similar to steps S410 to S480 on the second external device in the external device 299 (hereinafter referred to as the second external device), but the details of performing step S440 on the second external device are omitted. There are different.

具體而言,對於第二外部裝置,CPU 201可經配置以:判斷第二外部裝置是否具有作業系統(對應步驟S410);反應於判定第二外部裝置具有作業系統,判斷第二外部裝置是否具有虛擬環境(對應步驟S420);反應於判定第二外部裝置具有虛擬環境,取得第二外部裝置中對應於特定硬體裝置的一第二硬體裝置(例如第二外部裝置的CPU)的一第二可用硬體資源(對應步驟S430)。 Specifically, for the second external device, the CPU 201 may be configured to: determine whether the second external device has an operating system (corresponding to step S410 ); in response to determining that the second external device has an operating system, determine whether the second external device has an operating system virtual environment (corresponding to step S420 ); in response to determining that the second external device has a virtual environment, obtain a first hardware device (for example, a CPU of the second external device) corresponding to a second hardware device in the second external device 2. Available hardware resources (corresponding to step S430).

在取得第二硬體裝置的第二可用硬體資源之後,CPU 201可判斷第一可用硬體資源及第二可用硬體資源的總和是否滿足外部資源需求量。若是,則CPU 201可相應地調用第一硬體裝置及第二硬體裝置,並以第一硬體裝置、第二硬體裝置與特定硬體裝置協同運行前景程序、背景程序及作業系統服務。 After acquiring the second available hardware resource of the second hardware device, the CPU 201 may determine whether the sum of the first available hardware resource and the second available hardware resource satisfies the external resource requirement. If so, the CPU 201 can accordingly call the first hardware device and the second hardware device, and use the first hardware device, the second hardware device and the specific hardware device to cooperatively run the foreground program, the background program and the operating system service .

另一方面,若CPU 201仍判定第一可用硬體資源及第二可用硬體資源的總和未滿足外部資源需求量,則CPU 201可對外部裝置299中的第3個外部裝置再次執行相似於步驟S410~S480的內容,直至所考慮的N個外部裝置的可用硬體資源的總和滿足外部資源需求量為止。 On the other hand, if the CPU 201 still determines that the sum of the first available hardware resource and the second available hardware resource does not meet the external resource requirement, the CPU 201 can execute the process similar to the third external device in the external device 299 again. The content of steps S410 to S480 is until the sum of the available hardware resources of the N external devices under consideration satisfies the external resource requirement.

在一些實施例中,在執行步驟S330之後,CPU 201可判斷特定硬體裝置及各外部裝置的硬體裝置中任一的使用率是否高於一第二使用率門限值。若是,則CPU 201可重新訓練上述人工智慧模型,反之則可維持所述人工智慧模型。 In some embodiments, after step S330 is executed, the CPU 201 may determine whether the usage rate of any one of the specific hardware device and the hardware devices of each external device is higher than a second usage rate threshold. If so, the CPU 201 can retrain the above-mentioned artificial intelligence model, otherwise, it can maintain the artificial intelligence model.

詳細而言,在執行步驟S330之後,特定硬體裝置及各外部裝置的硬體裝置理應以較低使用率運行。換言之,若特定硬體裝置及各外部裝置的硬體裝置仍以高於第二使用率門限值(例如50%)的狀態運行,其代表上述人工智慧模型所推理而得的外部資源需求量可能因品質不佳而無法有效地降低特定硬體裝置及各外部裝置的硬體裝置。因此,CPU 201可相應地重新訓練上述人工智慧模型。 In detail, after step S330 is executed, the specific hardware device and the hardware devices of each external device should run at a lower usage rate. In other words, if the specific hardware device and the hardware devices of each external device are still running at a state higher than the second usage rate threshold (for example, 50%), it means that the external resource demand inferred by the above artificial intelligence model may be Hardware devices that cannot effectively degrade specific hardware devices and various external devices due to poor quality. Therefore, the CPU 201 can retrain the above-mentioned artificial intelligence model accordingly.

在一實施例中,CPU 201可維護有一觀察程式(observation agent),而此觀察程式可用於判斷特定硬體裝置及各外部裝置的硬體裝置中任一的使用率是否高於第二使用率門限值。若是,則觀察程式可提供一懲罰(punishment)信號,以觸發CPU 201重新訓練上述人工智慧模型。另一方面,若觀察程式判定特定硬體裝置及各外部裝置的硬體裝置的使用率皆未高於第二使用率 門限值,則觀察程式可提供一獎賞(reward)信號,以觸發CPU 201維持上述人工智慧模型,但可不限於此。 In one embodiment, the CPU 201 may maintain an observation agent, and the observation agent may be used to determine whether the usage rate of any one of the specific hardware device and the hardware devices of each external device is higher than the second usage rate Threshold value. If so, the observation program can provide a punishment signal to trigger the CPU 201 to retrain the above-mentioned artificial intelligence model. On the other hand, if the observation program determines that the usage rate of the specific hardware device and the hardware device of each external device is not higher than the second usage rate If the threshold value is set, the observation program can provide a reward signal to trigger the CPU 201 to maintain the above-mentioned artificial intelligence model, but it is not limited thereto.

綜上所述,本發明實施例提出的方法可在電子裝置因在虛擬環境中運行客戶作業系統而導致特定硬體裝置出現較高的使用率時,基於當下的前景程序、背景程序及作業系統服務決定相應的外部資源需求量,並進而調用外部裝置的硬體裝置來協助電子裝置執行上述前景程序、背景程序及作業系統服務。藉此,可降低電子裝置的特定硬體裝置的使用率,進而得到增加系統效能的效果。並且,透過適當地訓練用於推理外部資源需求量的人工智慧模型,可讓外部裝置的硬體裝置能夠較為智慧且合理地被調用。 To sum up, the method provided by the embodiments of the present invention can be based on the current foreground program, background program and operating system when the electronic device runs the guest operating system in the virtual environment and causes a high usage rate of a specific hardware device The service determines the corresponding external resource demand, and then invokes the hardware device of the external device to assist the electronic device to execute the aforementioned foreground program, background program and operating system service. In this way, the utilization rate of the specific hardware device of the electronic device can be reduced, thereby obtaining the effect of increasing the system performance. Moreover, by properly training the artificial intelligence model for inferring the demand of external resources, the hardware device of the external device can be invoked more intelligently and reasonably.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。 Although the present invention has been disclosed above by the embodiments, it is not intended to limit the present invention. Anyone with ordinary knowledge in the technical field can make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, The protection scope of the present invention shall be determined by the scope of the appended patent application.

S310~S330:步驟S310~S330: Steps

Claims (10)

一種適應性調用外部硬體資源的方法,適於一電子裝置,其中該電子裝置經建置有一虛擬環境,且該虛擬環境中運行有一客戶作業系統,包括: 反應於接收到來自該客戶作業系統的一虛擬裝置命令,取得該電子裝置中一特定硬體裝置的一使用率; 反應於判定該特定硬體裝置的該使用率高於一第一使用率門限值,取得該電子裝置的一前景程序、一背景程序及至少一作業系統服務,並依據該前景程序、該背景程序及該至少一作業系統服務決定一外部資源需求量; 基於該外部資源需求量調用至少一外部裝置的硬體裝置,並以該至少一外部裝置的該硬體裝置及該特定硬體裝置協同運行該前景程序、該背景程序及該至少一作業系統服務。 A method for adaptively calling external hardware resources, suitable for an electronic device, wherein the electronic device is built with a virtual environment, and a client operating system runs in the virtual environment, comprising: obtaining a usage rate of a specific hardware device in the electronic device in response to receiving a virtual device command from the client operating system; In response to determining that the usage rate of the specific hardware device is higher than a first usage rate threshold value, obtain a foreground program, a background program and at least one operating system service of the electronic device, and according to the foreground program and the background program and the at least one operating system service determines an external resource requirement; The hardware device of at least one external device is invoked based on the external resource requirement, and the foreground program, the background program and the at least one operating system service are cooperatively run by the hardware device of the at least one external device and the specific hardware device . 如請求項1所述的方法,其中依據該前景程序、該背景程序及該至少一作業系統服務決定該外部資源需求量的步驟包括: 將該前景程序、該背景程序及該至少一作業系統服務輸入經訓練的一人工智慧模型,其中該人工智慧模型因應於該前景程序、該背景程序及該至少一作業系統服務而輸出一特定資源需求量;以及 基於該特定資源需求量與該特定硬體裝置的一可用資源量決定該外部資源需求量。 The method of claim 1, wherein the step of determining the external resource requirement according to the foreground program, the background program and the at least one operating system service comprises: inputting the foreground program, the background program and the at least one operating system service into a trained artificial intelligence model, wherein the artificial intelligence model outputs a specific resource in response to the foreground program, the background program and the at least one operating system service demand; and The external resource requirement is determined based on the specific resource requirement and an available resource of the specific hardware device. 如請求項2所述的方法,其中在以該至少一外部裝置的該硬體裝置及該特定硬體裝置協同運行該前景程序、該背景程序及該至少一作業系統服務的步驟之後,更包括: 反應於判定該特定硬體裝置及各該外部裝置的該硬體裝置中任一的使用率高於一第二使用率門限值,重新訓練該人工智慧模型。 The method of claim 2, wherein after the step of cooperatively running the foreground program, the background program and the at least one operating system service with the hardware device of the at least one external device and the specific hardware device, further comprising: : In response to determining that the usage rate of any one of the specific hardware device and the hardware device of each of the external devices is higher than a second usage rate threshold, the artificial intelligence model is retrained. 如請求項1所述的方法,其中該至少一外部裝置包括一第一外部裝置,且基於該外部資源需求量調用至少一外部裝置的該硬體資源的步驟包括: 判斷該第一外部裝置是否具有一作業系統; 反應於判定該第一外部裝置具有該作業系統,判斷該第一外部裝置是否具有一虛擬環境; 反應於判定該第一外部裝置具有該虛擬環境,取得該第一外部裝置中對應於該特定硬體裝置的一第一硬體裝置的一第一可用硬體資源; 反應於判定該第一可用硬體資源滿足該外部資源需求量,調用該第一硬體裝置。 The method of claim 1, wherein the at least one external device includes a first external device, and the step of invoking the hardware resource of the at least one external device based on the external resource requirement comprises: determining whether the first external device has an operating system; In response to determining that the first external device has the operating system, determining whether the first external device has a virtual environment; In response to determining that the first external device has the virtual environment, obtaining a first available hardware resource of a first hardware device in the first external device corresponding to the specific hardware device; In response to determining that the first available hardware resource meets the external resource requirement, the first hardware device is invoked. 如請求項4所述的方法,其中反應於判定該第一外部裝置未具有任何作業系統,所述方法更包括忽略該第一外部裝置。The method of claim 4, wherein in response to determining that the first external device does not have any operating system, the method further comprises ignoring the first external device. 如請求項4所述的方法,其中反應於判定該第一外部裝置未具有任何虛擬環境,所述方法更包括控制該第一外部裝置建立該虛擬環境。The method of claim 4, wherein in response to determining that the first external device does not have any virtual environment, the method further comprises controlling the first external device to establish the virtual environment. 如請求項4所述的方法,其中該至少一外部裝置更包括一第二外部裝置,且反應於判定該第一可用硬體資源未滿足該外部資源需求量,所述方法更包括: 判斷該第二外部裝置是否具有該作業系統; 反應於判定該第二外部裝置具有該作業系統,判斷該第二外部裝置是否具有該虛擬環境; 反應於判定該第二外部裝置具有該虛擬環境,取得該第二外部裝置中對應於該特定硬體裝置的一第二硬體裝置的一第二可用硬體資源; 反應於判定該第一可用硬體資源及該第二可用硬體資源的總和滿足該外部資源需求量,調用該第一硬體裝置及該第二硬體裝置。 The method of claim 4, wherein the at least one external device further comprises a second external device, and in response to determining that the first available hardware resource does not meet the external resource requirement, the method further comprises: determining whether the second external device has the operating system; In response to determining that the second external device has the operating system, determining whether the second external device has the virtual environment; In response to determining that the second external device has the virtual environment, obtaining a second available hardware resource of a second hardware device in the second external device corresponding to the specific hardware device; In response to determining that the sum of the first available hardware resource and the second available hardware resource satisfies the external resource requirement, the first hardware device and the second hardware device are called. 如請求項1所述的方法,其中該虛擬裝置命令包括來自該客戶作業系統的一Virtio裝置命令。The method of claim 1, wherein the virtual device command comprises a Virtio device command from the guest operating system. 如請求項1所述的方法,其中反應於判定該特定硬體裝置的該使用率未高於該第一使用率門限值,更包括僅以該特定硬體裝置運行該前景程序、該背景程序及該至少一作業系統服務。The method of claim 1, wherein in response to determining that the usage rate of the specific hardware device is not higher than the first usage rate threshold value, further comprising running the foreground program and the background program only on the specific hardware device and the at least one operating system service. 一種電子裝置,其中該電子裝置經建置有一虛擬環境,且該虛擬環境中運行有一客戶作業系統,包括: 一儲存電路,儲存有多個模組;以及 一處理器,耦接於該儲存電路,並存取該些模組以執行下列步驟: 反應於接收到來自該客戶作業系統的一虛擬裝置命令,取得該電子裝置中一特定硬體裝置的一使用率; 反應於判定該特定硬體裝置的該使用率高於一第一使用率門限值,取得該電子裝置的一前景程序、一背景程序及至少一作業系統服務,並依據該前景程序、該背景程序及該至少一作業系統服務決定一外部資源需求量; 基於該外部資源需求量調用至少一外部裝置的硬體裝置,並以該至少一外部裝置的該硬體裝置及該特定硬體裝置協同運行該前景程序、該背景程序及該至少一作業系統服務。 An electronic device, wherein the electronic device is built with a virtual environment, and a client operating system runs in the virtual environment, comprising: a storage circuit storing a plurality of modules; and A processor, coupled to the storage circuit, accesses the modules to perform the following steps: obtaining a usage rate of a specific hardware device in the electronic device in response to receiving a virtual device command from the client operating system; In response to determining that the usage rate of the specific hardware device is higher than a first usage rate threshold value, obtain a foreground program, a background program and at least one operating system service of the electronic device, and according to the foreground program and the background program and the at least one operating system service determines an external resource requirement; The hardware device of at least one external device is invoked based on the external resource requirement, and the foreground program, the background program and the at least one operating system service are cooperatively run by the hardware device of the at least one external device and the specific hardware device .
TW109133249A 2020-09-25 2020-09-25 Electronic device and method and for adaptively arranging external hardware resources TWI768478B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109133249A TWI768478B (en) 2020-09-25 2020-09-25 Electronic device and method and for adaptively arranging external hardware resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109133249A TWI768478B (en) 2020-09-25 2020-09-25 Electronic device and method and for adaptively arranging external hardware resources

Publications (2)

Publication Number Publication Date
TW202213119A TW202213119A (en) 2022-04-01
TWI768478B true TWI768478B (en) 2022-06-21

Family

ID=82197375

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109133249A TWI768478B (en) 2020-09-25 2020-09-25 Electronic device and method and for adaptively arranging external hardware resources

Country Status (1)

Country Link
TW (1) TWI768478B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200513845A (en) * 2003-06-18 2005-04-16 Ibm Method, system, and program for incremental virtual copy
TW200914798A (en) * 2007-09-17 2009-04-01 Mitac Int Corp Navigation provision system and framework for providing content to an end user
TW201329853A (en) * 2011-10-14 2013-07-16 Microsoft Corp User controlled real object disappearance in a mixed reality display
US8756488B2 (en) * 2010-06-18 2014-06-17 Sweetlabs, Inc. Systems and methods for integration of an application runtime environment into a user computing environment
US20180005441A1 (en) * 2016-06-30 2018-01-04 Glen J. Anderson Systems and methods for mixed reality transitions
US20190004673A1 (en) * 2017-06-28 2019-01-03 Samsung Electronics Co., Ltd. Method for controlling display and electronic device supporting the same
US20190114840A1 (en) * 2017-10-16 2019-04-18 Comcast Cable Communications, Llc User interface and functions for virtual reality and augmented reality
TW201931179A (en) * 2017-07-13 2019-08-01 美商美國資生堂公司 Systems and methods for virtual facial makeup removal and simulation, fast facial detection and landmark tracking, reduction in input video lag and shaking, and a method for recommending makeup
TW201931063A (en) * 2017-12-29 2019-08-01 宏碁股份有限公司 Method for browsing virtual reality webpage content and electronic device using the same
US20200019295A1 (en) * 2018-07-15 2020-01-16 Magical Technologies, Llc Systems and Methods To Administer a Chat Session In An Augmented Reality Environment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200513845A (en) * 2003-06-18 2005-04-16 Ibm Method, system, and program for incremental virtual copy
TW200914798A (en) * 2007-09-17 2009-04-01 Mitac Int Corp Navigation provision system and framework for providing content to an end user
US8756488B2 (en) * 2010-06-18 2014-06-17 Sweetlabs, Inc. Systems and methods for integration of an application runtime environment into a user computing environment
TW201329853A (en) * 2011-10-14 2013-07-16 Microsoft Corp User controlled real object disappearance in a mixed reality display
US20180005441A1 (en) * 2016-06-30 2018-01-04 Glen J. Anderson Systems and methods for mixed reality transitions
US20190004673A1 (en) * 2017-06-28 2019-01-03 Samsung Electronics Co., Ltd. Method for controlling display and electronic device supporting the same
TW201931179A (en) * 2017-07-13 2019-08-01 美商美國資生堂公司 Systems and methods for virtual facial makeup removal and simulation, fast facial detection and landmark tracking, reduction in input video lag and shaking, and a method for recommending makeup
US20190114840A1 (en) * 2017-10-16 2019-04-18 Comcast Cable Communications, Llc User interface and functions for virtual reality and augmented reality
TW201931063A (en) * 2017-12-29 2019-08-01 宏碁股份有限公司 Method for browsing virtual reality webpage content and electronic device using the same
US20200019295A1 (en) * 2018-07-15 2020-01-16 Magical Technologies, Llc Systems and Methods To Administer a Chat Session In An Augmented Reality Environment

Also Published As

Publication number Publication date
TW202213119A (en) 2022-04-01

Similar Documents

Publication Publication Date Title
CN107851042B (en) Using command stream hints to characterize GPU workload and power management
US9858098B2 (en) Hypervisor modification of system tables
US10740154B2 (en) Method and apparatus for allocating computing resources of processor based on processor load, and terminal
TW201902226A (en) Frame rate adjustment method and image processing device
WO2019205172A1 (en) Power distribution method, device, and system of image processor
KR102222752B1 (en) Method of dynamic voltage frequency scaling of processor
US8880764B2 (en) Pessimistic interrupt affinity for devices
US9003094B2 (en) Optimistic interrupt affinity for devices
CN107209543B (en) Clock rate adjustment for processing unit
US11184263B1 (en) Intelligent serverless function scaling
US11635904B2 (en) Matrix storage method, matrix access method, apparatus and electronic device
KR102521654B1 (en) Computing system and method for performing graphics pipeline of tile-based rendering thereof
US8780120B2 (en) GPU self throttling
CN111274044B (en) GPU (graphics processing unit) virtualized resource limitation processing method and device
TWI768478B (en) Electronic device and method and for adaptively arranging external hardware resources
US11816347B1 (en) Creating virtual machine snapshots without interfering with active user sessions
CN114579295A (en) Method for adaptively calling external hardware resource
US11451615B1 (en) Probabilistic per-file images preloading
Mendis et al. Impact of memory frequency scaling on user-centric smartphone workloads
WO2023226312A1 (en) Service cluster scaling method and related device
CN117311628A (en) Command processing method, device, equipment and medium of solid state disk
JP2024015239A (en) Data processing equipment, data processing methods, electronic equipment and storage media
CN117667331A (en) Data processing method, apparatus, electronic device and computer program product
CN117312198A (en) Solid state disk control method, device, equipment and storage medium
CN117931689A (en) Data processing method, device, chip, equipment and storage medium