mysql gtid_executed and gtid_purged variables I would like to know where the gtid_executed and gtid_purged variables are stored in the database engine. If these are just runtime variables how exactly are they initialized?
They are not part of any particular storage engine. GTID variables can be seen by running:

SHOW GLOBAL VARIABLES LIKE 'gtid%';


or

SELECT * FROM information_schema.global_variables
WHERE variable_name LIKE 'gtid%';


When you run RESET MASTER on the DB Server, these values are blanked out.

MySQL Documentation says about gtid_executed


  Issuing RESET MASTER causes the global value (but not the session value) of this variable to be reset to an empty string. GTIDs are not otherwise removed from this set other than when the set is cleared due to RESET MASTER. The set is also cleared if the server is shut down and all binary logs are removed.


MySQL Documentation says about gtid_purged


  Issuing RESET MASTER causes the value of this variable to be reset to an empty string.


When SQL statements are executed, gtid_executed is updated with the GTID Set value.

MySQL Documentation says about gtid_executed


  When the server starts, @@global.gtid_executed is initialized to the union of the following two sets:
  
  
  The GTIDs listed in the Previous_gtids_log_event of the newest binary log
  The GTIDs found in every Gtid_log_event in the newest binary log.
  
  
  Thereafter, GTIDs are added to the set as transactions are executed.


gtid_purged can only be set when it is blank. Usually, you will set this variable set during the reload of a mysqldump whose source had GTID enabled.