Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.3 KiB

  1. Rough Design notes for Job Object Resource
  2. Based on genapp, this resource will allow users to take advantage of job
  3. objects on NT5. It provides for setting all the job object information via the
  4. properties associated with the resource. Here's a breakdown of how the
  5. different job info classes are utilized:
  6. JobObjectAssociateCompletionPortInformation
  7. The genjob resdll uses a completion port to get notified about various
  8. events for a job object. The CompletionKey is a pointer to the genjob
  9. resource object. This facility is used mainly to log interesting genjob
  10. events to the cluster log. Nothing is exposed to the user. Receiving
  11. JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO causes the offline event for the
  12. resource to be signalled.
  13. JobObjectBasicLimitInformation
  14. Each member (except for LimitFlags and Affinity) in this class will
  15. correspond to a resource property. Affinity poses a challenge since it is
  16. possible to have UP/MP nodes in the cluster. I'm not sure how to handle
  17. this right now. Initially, we won't support this
  18. feature. JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION will be set to avoid
  19. having hard popups from the system if a process terminates due to a
  20. fault. This will allow the job to fail over to the other side. Check boxes
  21. will be present to support the child process breakaway features. These
  22. properties can be modified while the resource is online.
  23. JobObjectBasicUIRestrictions
  24. basically, one check box per flag for this sheet.
  25. JobObjectEndOfJobTimeInformation
  26. Radio button indicating which option is enforce.
  27. JobObjectExtendedLimitInformation
  28. more edit boxes for the limits added by this class
  29. JobObjectSecurityLimitInformation
  30. This is potentially a difficult class to get working. It involves token
  31. handles, privileges and groups to be specified. There would be additional
  32. pages that would display groups and privileges. The main page would
  33. capture a domain account (including password) so a token handle could be
  34. generated under which to run the process. Hopefully, there are canned UI
  35. calls to display this type of info. The resdll will need to turn on assign
  36. primary token before supporting the JobToken field.
  37. Resource code
  38. Open
  39. same as genapp
  40. Online
  41. A critsec protects the creation of the completion port. A count of online
  42. resources is maintained: incremented during online and dec'ed during
  43. offline, it indicates when the completion port should be
  44. created/deleted. The final resource offline closes the port handle.
  45. Calls CreateJobObject, SetInformationJobObject (based on the properties),
  46. CreateProcess, and finally AssociateProcessToJobObject. Resource structure
  47. needs to be complete enough such that the comp. port handler can access
  48. the member without accvio'ing. This shouldn't be an issue since we
  49. probably just use the resource handle for logging. An event is used to
  50. signal resmon when the final process exits. The job handle maintains
  51. signal state but it is used to indicate when other limits have been
  52. exceeded.
  53. Offline
  54. calls TerminateJobObject (harsh but consistent with genapp). closes job
  55. obj handle. if last resource is taken offline, completion port giblets are
  56. closed as well.
  57. Close
  58. same as genapp