affinity

Android 代码优化点滴

天大地大妈咪最大 提交于 2020-01-23 02:13:01
MVC 模型:Mode,View,Controller与view相关的类:DragLayer (自定义的帧布局DragLayer 包含hotseat ,workspace ,和DragController , DragListener 等一起使得桌面上的shortcut具备拖动功能,和DropTarget一起具备删除功能 桌面拖动,删除的处理:将workspace 和DragLayer通过一些接口:DropTarget, DragSource, DragScroller配套完成,DragLayer 和DragController 操纵以上接口类,在workspace 去实现具体)àworkspace(自定义的类似pageview,自己可以snapToPage,即可在不同的cellLayout之间切换,同时实现拖动,触摸等接口,做具体的动作)à cellLayout(默认一个workspace 包含两个cellLayout,可以增加,删除 )à ShortcutAndWidgetContainer(在cellLayout 中,真正是它来确定桌面上的Shortcut 的位置,大小等)à (ShortcutInfo,FolderInfo) 与Mode 相关的类:LauncherProvider 提供和数据库直接操作相关的接口,LauncherModel 非UI线程(后台线程

Application Fundamentals (2/n)

两盒软妹~` 提交于 2020-01-22 09:15:09
1. Activities and Tasks 1.2 Affinities and new tasks 默认情况下,在一个程序中的所有activity都在一个affinity中,这个也使这些activity属于同一个task。但是我们可以在<activity>标签中设置taskAffinity属性来为每一个activity指定一个单独的affinity。不同的应用程序的activity可以被指定为相同的affinity,在同一个应用程序的多个activity也可以被指定为在不同的affinity中。在两种情况下,affinity会起作用: 1) 启动activity的Intent对象中包含 FLAG_ACTIVITY_NEW_TASK 标志。 2) 一个activity将 allowTaskReparenting 属性 设置为true。 FLAG_ACTIVITY_NEW_TASK 标志: 默认情况下,通过 startActivity() 方法激活的activity会加入到和调用者相同的task中,也会放到和存放调用者相同的stack中。但如果传递给 startActivity() 方法的的Intent对象包含了 FLAG_ACTIVITY_NEW_TASK 标志,系统就会把这个新激活的activity放到一个不同的task中去。正如这个标志的字面意义那样,它是一个新的task

Set thread affinity on two cores using OpenMP

懵懂的女人 提交于 2020-01-16 08:12:46
问题 I am using a C program, compiled with gcc 4.9.2 on Windows7, using OpenMP 4.0. My computer is dual core, with four threads. I'd like to use thread affinity spread and use 2 threads put on different cores. So when I set the environment variables from DOS with: set OMP_NUM_THREADS=2 set OMP_PROC_BIND=spread set OMP_PLACES="cores" I get, with the variable OMP_DISPLAY_ENV=true, this: libgomp: Invalid value for environment variable OMP_PLACES OPENMP DISPLAY ENVIRONMENT BEGIN _OPENMP = '201307' OMP

Is it possible to prevent children inheriting the CPU/core affinity of the parent?

北慕城南 提交于 2020-01-14 20:01:54
问题 I'm particularly interesting in doing this on Linux, regarding Java programs. There are already a few questions that say you have no control from Java, and some RFEs closed by Sun/Oracle. If you have access to source code and use a low-level language, you can certainly make the relevant system calls. However, sand-boxed systems - possibly without source code - present more of a challenge. I would have thought that a tool to set this per-process or an kernel parameter are able to control this

Threads and CPU Affinity

你离开我真会死。 提交于 2020-01-13 20:28:30
问题 Lets say there are two processors on a machine. Thread A is running on P1 and Thread B is running on P2. Thread A calls Sleep(10000); Is it possible that when Thread A starts executing again, it runs on P2? If yes, who decides this transition? If no, why not? Does Processor store some data that which all threads it's running or OS binds each thread to Processor for its full lifetime ? 回答1: It is possible. This would be determined by the operating system process scheduler and may also be

转载——Activity启动模式 及 Intent Flags 与 栈 的关联分析

你离开我真会死。 提交于 2019-12-31 23:15:10
转载地址: https://blog.csdn.net/vipzjyno1/article/details/25463457 在学习Android的过程中,Intent是我们最常用Android用于进程内或进程间通信的机制,其底层的通信是以Binder机制实现的,在物理层则是通过共享内存的方式实现的。 Intent主要用于2种情景下:(1)发起意图 (2)广播 它的属性有:ComponentName,action,data,category,extras,flags等,通常情况下,进行Intent的匹配涉及到3个属性:Action,Data,Category。这些东西都需要了解才能对它有个深入的体会。 下面我就根据近期学习,总结记录下Activity启动模式 及 Intent Flags 与 栈 的关联分析。 文章结构: 1.什么是栈 2.Activity栈 3.Task 4.Activity启动模式 5.Activity栈和Task联系 6.Intent Flags 7.Activity相关属性taskAffinity 1.什么是栈 栈 栈是一种常用的数据结构,栈只允许访问栈顶的元素,栈就像一个杯子,每次都只能取杯子顶上的东西,而对于栈就只能每次访问它的栈顶元素,从而可以达到保护栈顶元素以下的其他元素.”先进后出”或”后进先出”就是栈的一大特点

Openmp thread affinity: Set 2 threads in the program, how many cores are running?

限于喜欢 提交于 2019-12-25 07:33:07
问题 I wrote an Openmp Program, running it on a two core machine. When I changed the thread number from 1 to 2 and from 2 to 4, I couldn't get the 2x speed up. 2 threads to 4 threads, that's the hyperthreads. Hyperthreads generally can't get 2x speed up because of resources limitation. However, 1 threads to 2 threads, still can't get the 2x speed up, I feel confused about this.I searched and found the CPU affinity concept, but I can't figure out how Openmp works. When I use 2 threads, does Openmp

VB.net Process Affinity

試著忘記壹切 提交于 2019-12-24 02:51:50
问题 Goal: My goal is to set all running processes's affinity to 1 core. Then launch a program with the affinity of all the cores. Skill Lvl: My skill level in programming in general is pretty much beginner. This is my first language. Need: I would like some help with this coding and maybe an article or description of the code. Thank you 回答1: There is a C# solution here. In summary, you need to loop through all processes ( Process.GetProcesses ) and set their .ProcessorAffinity to New IntPtr(1) ,

Why does NextValue call of performanceCounter change thread affinity mask

我是研究僧i 提交于 2019-12-23 12:26:45
问题 I have a C# project, where I have to both access the current workload of my processor, and ensure, that I run some specific code on every kernel of the processor. My problem is, that accessing the workload of my processor seems to prevent me from correctly assigning a thread affinity mask. I have some code here, that illustrates the problem: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics;

How to use Java Native Access to set process affinity for processes besides Java.exe?

a 夏天 提交于 2019-12-23 12:22:50
问题 Although it is fairly easy to do manually, I am attempting to automate the setting of cpu affinity in Windows 7 for various VMs after their initial creation time. The project is in Java and I am trying to avoid directly including C code, so I have been using Java Native Access, which masks things like winapi. I'm new to the library, and it's a bit lacking in tutorials or examples, although there are some basic ones findable through quick Google searches. Using the following code, I can set