## 5 Surface Modification Used for Mg Alloys  
In addition to tweaking the bulk alloy chemistry to avoid toxicity and manipulate mechanical properties, the toxicity can be reduced by forming coatings on the surface, which impedes the release of toxic ions so that the local ion concentration can be kept below toxic levels and the corrosion rate is also inhibited. When MgO is exposed to ionizing radiation, energy is transferred to the MgO crystal, promoting the ejection of electrons from their bound states, which interact with impurity atoms in the crystal lattice. The ionization-radiation-induced alterations in MgO extend beyond impurity states, encompassing the creation of defects such as the V1 center, which influences materials' electronic and optical properties. However, MgO is radiation resistant and relatively stable compared with other materials. The radiation-induced damage to MgO is minimal, with zero compromise to its functionality. This is due to its ability to emit light when exposed to ionizing radiation and has been employed as a scintillator material in radiation detectors. However, the response of MgO to pulsed laser irradiation revealed defect formation, surface fracture, and rapid vaporization [72; 73]. On the other hand, electronic irradiation-induced electronic defects within the MgF\({}_{2}\) crystal affect the material's electronic structure and properties [74]. Coatings allow the use of alloys with excellent mechanical properties, even if they contain some toxic ions. Such surface modifications may also enhance the bioactivity of these biodegradable materials [62]. The precise impact of different alloying elements incorporated into the Mg substrate on coating kinetics and the resultant properties affecting corrosion resistance and biocompatibility remains somewhat elusive. Nevertheless, it is acknowledged that the coating's hardness directly influences biocompatibility. Several surface modification techniques, such as surface coating, chemical conversion coatings, biomimetic deposition, micro-arc oxidation coating, sol-gel coating, and ion implantation, have demonstrated enhancements in prolonging the in vivo lifespan of Mg implants. Yet, utilizing coatings and surface modifications in a controlled environment faces several considerations. These encompass challenges such as the constraints associated with rapid corrosion, the generation of substantial hydrogen gas volumes, and the potential accumulation of hydrogen bubbles in gas pockets. Addressing these \"surface\" factors is imperative before contemplating the large-scale production of Mg alloys for use as implants [75]. Improving the mechanical and tribological properties of magnesium alloys, such as tensile strength, hardness, corrosion resistance, and wear resistance, can be accomplished by generating a surface composite layer with reinforcement particles through friction stir processing (FSP). Despite numerous attempts to develop multi-functional coatings for magnesium-based alloys, addressing the issue of localized corrosion without compromising mechanical strength over an extended period remains an unresolved challenge. The search for an optimal solution continues [76; 77]. Two general types of surface modification are used for Mg alloys: (a) surface coating preparation and (b) surface microstructure modification. Surface coating preparation:  
The oxide film formed on the Mg alloy surface is generally weak, which cannot chemically or mechanically protect the alloy for long exposures. Hence, there is a need to make a protective film on the surface utilizing chemical, physical, mechanical, and biological or biomimetic techniques [78]. Chemical conversion coatings:  
These coatings are formed by electrochemical or chemical reactions of Mg-based alloys within an electrochemical bath to form a layer that often contains fluoride, phosphates, carbonate, or chromate groups [68; 79; 80].